threejs
threejs
threejs
Would you like to react to this message? Create an account in a few clicks or log in to continue.


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

 

 How to customize materials through ShaderMaterial ?

Go down 
3 posters
AuthorMessage
Atrahasis




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

How to customize materials through ShaderMaterial ? Empty
PostSubject: How to customize materials through ShaderMaterial ?   How to customize materials through ShaderMaterial ? Icon_minitimeFri 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
Admin


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

How to customize materials through ShaderMaterial ? Empty
PostSubject: Re: How to customize materials through ShaderMaterial ?   How to customize materials through ShaderMaterial ? Icon_minitimeSat 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
https://threejs.forumotion.com
Atrahasis




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

How to customize materials through ShaderMaterial ? Empty
PostSubject: Re: How to customize materials through ShaderMaterial ?   How to customize materials through ShaderMaterial ? Icon_minitimeSat 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

SamCorny


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

How to customize materials through ShaderMaterial ? Empty
PostSubject: Re: How to customize materials through ShaderMaterial ?   How to customize materials through ShaderMaterial ? Icon_minitimeSat 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





How to customize materials through ShaderMaterial ? Empty
PostSubject: Re: How to customize materials through ShaderMaterial ?   How to customize materials through ShaderMaterial ? Icon_minitime

Back to top Go down
 
How to customize materials through ShaderMaterial ?
Back to top 
Page 1 of 1
 Similar topics
-
» Materials Editor based on Slots

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: