sebkaine Posted July 15, 2015 Share Posted July 15, 2015 Hi guys , I would like to understand exactly what getglobalraylevel() do. and what is the difference with his counterpart getraylevel(). The doc explanation is not crystal clear in my mind ! From what i understand this allow you to modify each ray computation according to the number of bounce ? So for exemple you have Reflection Bounce Limit set to 10 Refraction Bounce Limit set to 10 if ( getglobalraylevel() == 0 ) { } -> allow to select primary ray throw from the camera if ( getglobalraylevel() < 3 ) { } -> allow to select primary ray + the ray that has bounce 1 or 2 time if ( getglobalraylevel() < 30 ) { } -> is usless because you will select all the rays as the bounce limit is set to 10 what would be the difference with if ( getraylevel() == 0 ) { } -> ? if ( getraylevel() < 3 ) { } -> ? if ( getraylevel() < 30 ) { } - >? Is it possible to set a per bounce per type of bounce behavior for each ray ? for exemple select : ray of reflection under 3 bounce ? ray of indirect diffuse with 1 bounce ? How would you do that in Mantra ? Thanks For your time ! Cheers E Quote Link to comment Share on other sites More sharing options...
SSFX Posted July 16, 2015 Share Posted July 16, 2015 (edited) If you look at the vex files provided in HFS they only use getglobalraylevel() for global illumination. All the PBR related code use getraylevel(). Maybe it's an optimization for PBR, I don't really know. The doc is not really helping that's for sure! Is it possible to set a per bounce per type of bounce behavior for each ray ? That could be what you're looking for: http://forums.odforce.net/topic/19041-pbr-rayswitch/?hl=getraylevel#entry127410 Alex Edited July 16, 2015 by SSFX Quote Link to comment Share on other sites More sharing options...
fathom Posted July 16, 2015 Share Posted July 16, 2015 (edited) you can limit the bounces already, but i don't think you can really have a shader react differently under different circumstances unless you modify the pbr vex code to track the different bounce types and then pass that data along to the shaders via the trace function. it's doable, but it would take some effort. edit: oh and the getglobalraylevel() looks like it's only non-zero when gi is being calculated, so presumably indirect diffuse could be identified separately from relfection/refraction in your shader. Edited July 16, 2015 by fathom Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 16, 2015 Author Share Posted July 16, 2015 (edited) Many thanks for the info guys ! so if i get things correctly, when Mantra is in PBR mode. - It lunches ray from the camera, (uni-directional pathtracing) - you can identify each ray properties lunch from the camera with those 2 functions. When you say "Global Illumination" why did you mean precisly by that : Rendering with at least one Bounce of indirect diffuse ? Denis code is extremely helpful : int pathstate; string label; rayimport("pathstate", pathstate); label = bouncelabel(pathstate); if (getraylevel() == 0) { ray = 0;} // primary visibility else if (label == "reflect") { ray = 1;} else if (label == "refract") { ray = 2;} else if (label == "diffuse") { ray = 3;} so with getraylevel() you can isolate for each ray : - his label reflect / refract / diffuse - his depth with the number of bounce getglobalraylevel() is only useful when indirect diffuse (1 bounce or more ) is activated and it allow you to identify - indirect diffuse ray ("GI ?") - the depth with the number of bounce Am i getting things correctly ? This command looks to be extremely powerful for optimise rendering so i would like to be sure i get things correctly ! Cheers E Edited July 16, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
SSFX Posted July 16, 2015 Share Posted July 16, 2015 From the tests I have done getglobalraylevel() doesn't work in PBR mode, it always return 0. In fact, it only seems to work with other renderers like raytracing and micropoly when using the gilight. It doesn't take into consideration refraction or reflection and it only counts the diffuse bounces of the gilight. So if you want to work with PBR you can forget about getglobalraylevel() which seems to serve a very specific purpose. Other than that, I tried modifying behaviors based on the return value of getglobalraylevel() and it took ages just to modify color of the rays. I think this function is only used to detect if the ray is a gi bounce or not. 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 16, 2015 Author Share Posted July 16, 2015 (edited) Very interesting Alexandre, so as i am focusing on PBR mainly , i can forget about getglobalraylevel() ... I would be curious what you mean by GI exactly , cause i am pretty new to Mantra and i don't know what was the legacy workflow for computing GI. How would you compute GI in H before the PBR era and what was the workflow correlated to the getglobalraylevel(). - ptc base indirectdiffuse() like prman ? - final gather like mental ray ? - photon base gi like mental ray ? from the doc it looks that the indirect light node was the core of this but if you have additional info that would be great ! Thanks again for your time ! Edited July 16, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
fathom Posted July 16, 2015 Share Posted July 16, 2015 you can currently identify what type of ray you are and what level of ray bounces have lead up to the current shader call. what you can't do is determine how many times you've reflected vs refracted... not sure if that's interesting info for you or not. 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 16, 2015 Author Share Posted July 16, 2015 thanks for the info Miles ! : every info on Mantra is interesting to me ! Cheers E Quote Link to comment Share on other sites More sharing options...
SSFX Posted July 16, 2015 Share Posted July 16, 2015 Hey Emmanuel, I'm no mantra pro by any means, I started working with mantra about a year ago. I always tend to stick with PBR since it's closer to what I already know and have extensively used in production (Arnold, Guerrilla). When I say GI, I mean the GI light in the shelf, the one using Photon Map to generate indirect diffuse information without path tracing. It seems to be very close to photon mapping in VRAY or Final Gather in Mantal Ray. I've seen a lot of people using it for caustic or interior scenes, but I personally tend to avoid it if I can get away without processing a point cloud every time I move or add a light. Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 18, 2015 Author Share Posted July 18, 2015 (edited) well i did some research in older topic, all is still messy in my head but it looks that GI stuff in pre-PBR era are related to those core function occlusion(); irradiance(); photonmap(); pathtrace(); gather(); trace(); so basically you have: - raytrace occlusion() and irradiance() (limit to 1 bounce) like in prman - point cloud counter part doesn't exist in mantra but some attempt have been done by users , they doesn't look to be 100% production ready ... - pathtrace() allow you to replace irradiance() by using the PBR engine only to compute secondary bounce - photonmap() looks to works more in the sense of final gather for indirect diffuse with ray throw from the camera, but it look to work like the photon workflow for caustics where ray are send from the light. I have find no evidence of indirect diffuse computed from photon send from the lights. well things are not sharp yet in my mind, would have bee cool to have a nice clean description of all the GI technics in the doc ... this one is quite useful but not complete http://127.0.0.1:48626/render/understanding i still need to figure the difference beetween trace and gather for throwing rays ! Edited July 18, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.