excuse me but i don't quite get the normals from vectors like the viewproj and stuff in shaders.
it's a GLSL question
I know where the camera is vec3(0.0,0.0,1.0) but for example how do i get a vector to vec3(0.0,0.0,1.0) from every single vertex???
I need it to implement a FAKED fresnel effect
And one more, how do i project textures??
like shadows and water caustics???
little help with shaders
If you are wondering about how to send a variable to your GLSL codes, the answer is in example/tutorial 10.
In short, set the variable with setVertexShaderConstant in the callback.
for example if this is in the callback:
the variable can be "retrieved" in the GLSL code like this:
As to your particular application, reflection and refraction are common topics for shaders;
a quick google would yield a lot of useful results.
In short, set the variable with setVertexShaderConstant in the callback.
for example if this is in the callback:
Code: Select all
irr::core::vector3df pos(0,0,1);
services->setVertexShaderConstant("mLightPos", reinterpret_cast<irr::f32*>(&pos), 3);
Code: Select all
uniform vec3 mLightPos;
a quick google would yield a lot of useful results.
oh well i know about passing these but i think for you to under stand i would need to draw a diagram
the fact of the matter is that...
lets take a look at this the | symbolises normal
the / symbolises the vector towards the camera vec3(0.0,0.0,1.0)
C is the cam
as you can see only on vector towards the camera meets it, all the others shooting from other vertexes are parallel but miss it
What I am trying to achieve is to get a vector for each vertex, that meets the camera i.e.[/code]
the fact of the matter is that...
lets take a look at this the | symbolises normal
the / symbolises the vector towards the camera vec3(0.0,0.0,1.0)
C is the cam
Code: Select all
C
/ / / / / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / / / / / /
|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
What I am trying to achieve is to get a vector for each vertex, that meets the camera i.e.
Code: Select all
C
/|\
/_|_\