Hi,
I want to adapt the lambert shader to add custom color/texture and reflection per triangle.
How can i achieve that? I know how to apply texture to the triangles, have it woring in another simple shader. But without shadow and reflection of light, which i would like to have.
I copied the frag and vert for lambert from here: three.js/meshlambert.glsl.js at 3f1dce330f9a872ad164e10e481ab1bb6aeffa30 · mrdoob/three.js · GitHub
and tried to replace the emissive color to my own color in the shader, but it remained black. Also tried to replace the diffuse color.
vec4 diffuseColor = vec4( mycolor, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = mycolor;
Hi!
Could you provide more details about what you have and the desired result? Any explanatory/reference pictures?
Hi,
I have a planet on which i want to draw terrain based on textures. That’s working, but i want to add reflection on the ocean tiles and have the planet half in shadow depending on sun position.
Now i just copied the lambert shader and trying to add the code for the textures correctly. But I’m not sure to which variable i need to set the colour to
Do you make some computations, based on data from textures, in shaders? Or maybe is it enough to use .map
in MeshLambertMaterial
?
Yes,i do extra computations in the shader.
Also, thats only a colour map. Would it work for textures too?
Would be better to provide a working live code example, that demonstrates the issue (jsfiddle, codepen, codesandbox etc.)