![]() |
|
|
#1
|
|||
|
|||
|
Hello
I think I've got a very tricky question here but maybe someone can crunch it since I so far was unable to I wonder is there any way to access the ray derivatives in a shader? I explicit mean the RAY not surface derivatives. If you wonder why you basically need the ray derivatives for example for super sampling or accurate texture sampling (to estimate the anisotropic sampling direction) and they normally should change under reflection and refraction. The state object itself doesn't hold that information and I couldn't really find any method to get them either. Does mental ray not make this information public accessible? If yes that would be a real shame. |
|
#2
|
|||
|
|||
|
Hi,
unfortunately, it seems that mr does not calculate ray derivatives at all (which is a shame...). What you can do is to overload all the mi_trace_... and store your custom ray derivatives with mi_shaderstate_set It will only work with your custom shaders though... |
|
#3
|
|||
|
|||
|
Quote:
Quote:
Oh well guess can't do anything about it. I wish mental images will add that in one of the upcoming mental ray versions (altough very unlikely). Thanks again for your answer and confirming my guess. |
|
#4
|
|||
|
|||
|
You're right, actually it is a real problem for filtering. If you look at the anisotropic filtering example, you will see that they only compute the filtering size using the camera projection matrix (this only works for primary rays, for secondary rays you have to think of something yourself).
And yes, if you compute the ray derivatives yourself you have to go only with your shaders (beginning by a lens shader...) I've been asking for ray derivatives for years now, but no success so far, maybe if we are many to ask for it... |
|
#5
|
|||
|
|||
|
Quote:
Quote:
Quote:
|
|
#6
|
|||
|
|||
|
This functionality (including computation of differentials over reflections and refractions) has been added in mental ray 3.8.
Juri |
|
#7
|
|||
|
|||
|
Hello I've run into a similar issues with one of my shaders
(http://www.antiflash.net/microfacetglass). So I saw this post. Juri can you tell where you can get / set this derivative information inside your own material shader? I checked the state object and shader.h (with mr3.8 headers) and I couldn't obviously see any easy way to get this information. Thank you! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT +1. The time now is 15:07. |