threejs


WebGL and Three JS dedicated forum. Here we can discuss about Three JS 3D library.
 
HomeCalendarGalleryFAQSearchRegisterLog in

Share | 
 

 How to customize materials through ShaderMaterial ?

View previous topic View next topic Go down 
AuthorMessage
Atrahasis



Posts : 5
Points : 10
Reputation : 1
Join date : 2017-02-17

PostSubject: How to customize materials through ShaderMaterial ?   Fri Feb 17, 2017 3:05 pm

Small issue here that has been posted on SO yet there :
http://stackoverflow.com/questions/41958896/customize-material-in-threejs

The thing is : I would like to customize the MeshStandardMaterial, without changing the original shader strings meshphysical_frag and meshphysical_vert obviously.

So I copied them in the fragmentShader and vertexShader strings of a ShaderMaterial (with my changes), and copied the original uniforms (I don't feel like flooding with the whole code, but it is reproduced in the stackoverflow question).

However the render always fails with the following error :
Code:
Cannot read property 'color' of undefined at the function StructuredUniform.setValue

I cannot find where the issue is.

Where is the mistake, is it the correct way to cutomize materials in Threejs ?
Back to top Go down
Admin
Admin
avatar

Posts : 46
Points : 78
Reputation : 3
Join date : 2017-02-06
Location : London, Milan

PostSubject: Re: How to customize materials through ShaderMaterial ?   Sat Feb 18, 2017 11:20 am

Well man, im working on a little material editor where its possible to customize materials and shaders. Im still working on it so please be patient and I will share some code about it ok?
Hope that can be useful.
Let me also check your code as well
Back to top Go down
http://threejs.forumotion.com
Atrahasis



Posts : 5
Points : 10
Reputation : 1
Join date : 2017-02-17

PostSubject: Re: How to customize materials through ShaderMaterial ?   Sat Feb 18, 2017 12:36 pm

Hey, thanks, great project ! no problem.

The full material code is in the stackoverflow question : I first reproduced the original shaders and uniforms without modifications (I think it is from r83), but even that is not working.
Back to top Go down
SamCorny

avatar

Posts : 40
Points : 56
Reputation : 0
Join date : 2017-02-06
Location : NYC

PostSubject: Re: How to customize materials through ShaderMaterial ?   Sat Feb 18, 2017 2:23 pm

Hi man i basically take a look at your example. I think there is something a bit more complicated. For my opinion try this simple material:

Code:
[code]
            var material = new THREE.MeshPhongMaterial( {
               color: 0xff0000,
               shininess: 150,
               metalness: 40,
               specular: 0x222222,
               shading: THREE.SmoothShading
            } );
[/code]

and substitute shading property with variables.
Im still working on materials Smile
Back to top Go down
Sponsored content




PostSubject: Re: How to customize materials through ShaderMaterial ?   

Back to top Go down
 
How to customize materials through ShaderMaterial ?
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Basing Materials
» Dark materials: What is their best use before HR9?
» Can You Make Wolfenstein Characters in Other Graphics Engines?
» New, looking for advice on materials.
» Early tools

Permissions in this forum:You cannot reply to topics in this forum
threejs :: WEBGL and Three JS Library :: Discussions about WebGL coding via Three.js-
Jump to: