Hi to all,
I'm trying to do some porting from GLSL shaders to HLSL in Ventuz. One problem I have is: how can I know my eyeposition (camera position) into the shader code?
For example, even to compute specular lighting effect, I need the eye position to calculate the specular reflection..
I can't find the right constant for "eyeposition" in the documentation:
http://www.ventuz.com/support/help/V4_0 ... hader.html
Anyone can help?
Thank you!
Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
How to obtain eyeposition in shaders?
Moderator: Support
-
- Posts: 33
- Joined: 30 Sep 2015, 10:49
Re: How to obtain eyeposition in shaders?
Method 1: Use viewspace to compute lighting. This would probably make your program run faster as well.
Method 2: The hard way. Getting Camera position through view matrix. Check out this post on SO.
Hope this helps.
-C
Method 2: The hard way. Getting Camera position through view matrix. Check out this post on SO.
Hope this helps.
-C
-
- Posts: 33
- Joined: 30 Sep 2015, 10:49
Re: How to obtain eyeposition in shaders?
Oh, and you can always pass your camera position in world space as uniform variables if everythings else fails.
Or take a look at the glm::lookAt() function and implement it directly in your shader. This would even save you a camera node.
Or take a look at the glm::lookAt() function and implement it directly in your shader. This would even save you a camera node.