WebGL and Three JS dedicated forum. Here we can discuss about Three JS 3D library. |
| | How to customize materials through ShaderMaterial ? | |
| | Author | Message |
---|
Atrahasis
Posts : 5 Points : 10 Reputation : 1 Join date : 2017-02-17
| Subject: 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-threejsThe 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 ? | |
| | | Admin Admin
Posts : 46 Points : 78 Reputation : 3 Join date : 2017-02-06 Location : London, Milan
| Subject: 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
| |
| | | Atrahasis
Posts : 5 Points : 10 Reputation : 1 Join date : 2017-02-17
| Subject: 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. | |
| | | SamCorny
Posts : 40 Points : 56 Reputation : 0 Join date : 2017-02-06 Location : NYC
| Subject: 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 | |
| | | Sponsored content
| Subject: Re: How to customize materials through ShaderMaterial ? | |
| |
| | | | How to customize materials through ShaderMaterial ? | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Our first goal | Mon Feb 27, 2017 10:12 am by Admin | More than 20 users,
almost 150 posts,
a new big project is coming,
about …
| Comments: 0 |
Forum changements | Tue Feb 21, 2017 6:10 pm by Admin | Dear members,
I have personally made some changements into the forum, now …
| Comments: 2 |
A new revision of the forum rules | Tue Feb 07, 2017 9:40 pm by Admin | Dear Members,
it is my pleasure to tell you below all the new functions I …
| Comments: 0 |
Top posting users this week | |
|
|