Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Need advice for make Shader

$
0
0

Hi, guru's!

 

I need advice or dig direction.

 

Problem:

Make shader material (glsl) and in vertex shader i change vertexes position. It work ok and results is pretty.

 

BUT (yes, again this damn "BUT") :)

 

In fragment shader i need normal for compute reflection, diffuse and etc.

 

Source mesh is flat, and all normal look up and equal.  Vertex shader change vertex position, but normals stay not changed.

 

How i can recalculate (or get somewhere :)) ) new normals?  In vertex shader i have only ONE current vertex, but for calculate normal we need face (i think :) i.e. 3 vertexes).

How get new normal in current vertex in new position? Help please!

 

p. s.

http://www.babylonjs.com/cyos/  Template "wave"  we have near situation, but normal (as i understand) not recalc and in distortion result we not get real light piscture.... or have?  Trap...

 


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>