Jump to content

Volume quality relative to camera distance ?


Recommended Posts

Hey Guys,

 

I'm trying to optimize some renders and I wonder if there is anyway of changing the volume quality based of distance from camera. I have a custom CVEX volume procedural that adds lots of detail but I need detail in the front but less so at the back of the volume so I'm looking to see if the renderer could march bigger steps as it progresses through the volume ?

 

Does anyone know if its possible in Mantra ?

Link to comment
Share on other sites

i don't know if this will help you ,and you might already know that but this is interesting to control your ray throw depth 

http://forums.odforce.net/topic/19041-pbr-rayswitch/?hl=rayswitch

 

those VEX function Might be useful !

- getraylevel()

- getglobalraylevel()

 

Hope that help !

Edited by sebkaine
Link to comment
Share on other sites

Thanks Sebkaine for your answer.

 

I am looking through the documentation of these functions. However I do not see how this can achieve what I am looking for.

 

Basically I have some CVEX code that generates a Volume through the vex volume procedural node which is attached to an empty sop which in turn is then attached to a shader.

This CVEX code has the potential to generate a high detail animated volume that I will render as an isosurface as I want a hard surface. I might also want that surface to be transparent etc... perhaps applying a glass shader etc...

In order to get the high detail I need for the CVEX code to be usefull at present I need to set the volume quality to 100+ which makes the render time escalate. However this is only needed to get the detail necessary close to the camera. If I set the volume quality to 20 or 10 I can get away with midground stuff and bring it down to 1 for background stuff. As the isosurface will most certainly be transparent reflective/refractive I am just trying to make the render manageable. What would be awesome is to be able to control the marcher so it could work in steps going for example from 0.001 unit is space close to camera to over 1 unit at the back where detail is less likely to be important.

 

I have tried writing a custom shader that does this through a little raytracer within it, and it works very well I can get very high quality detail close to vamera. However this means I am outside of the Mantra standard renderer and need to implement everything I need in the shader, reflection refraction opacity lighting etc.... which I am trying to avoid thus trying an isosurface approach first. If I can't get my renders to a manageable level then I will have to go down and push the custom shader further.

 

Cheers

Link to comment
Share on other sites

Hey Fathom,

 

I am already trying to do this, I also wanted to couple that idea with the raymarching too. But wanted to make sure it was worth it too.

 

As I've just tried, even if I just set the output of the CVEX shader to a constant 1 value within a predetermined box and 0 outside of it,  with a volumequality of over 100 it really is faster IF I have no transparency but if it has some transparency then the marcher has to march through the whole cube at the rate specified to get the detail closeup which is a shame.

 

Thanks

Link to comment
Share on other sites

I am looking through the documentation of these functions. However I do not see how this can achieve what I am looking for

 

well i'm definitly no mantra expert but from what you've describe you want to augment the marching distance beetween each sample throw Z

i haven't find the time to play really with the getraylevel() functions but it looks to be a nice tool for optimising what your ray do throw Z.

but it doesn't answer directly your question about raymarching. :)

 

This CVEX code has the potential to generate a high detail animated volume

- that I will render as an isosurface as I want a hard surface.

- I might also want that surface to be transparent etc... perhaps applying a glass shader etc...

 

In order to get the high detail I need for the CVEX code to be usefull at present I need to set the volume quality to 100+ which makes the render time escalate.

 

However this is only needed to get the detail necessary close to the camera. If I set the volume quality to 20 or 10 I can get away with midground stuff and bring it down to 1 for background stuff.

 

As the isosurface will most certainly be transparent reflective/refractive I am just trying to make the render manageable. What would be awesome is to be able to control the marcher so it could work in steps going for example from 0.001 unit is space close to camera to over 1 unit at the back where detail is less likely to be important.

 

For the raymarching expertise i would definitly more rely on Miles advise than on mine.

 

But from what you describe i think i would also investigate the VDB ways for the following reason:

- at the end the outpout you want is a hard surface mesh that draw nice procedural forms

- this mesh will be raytraced

 

On such task i would not try to draw things 100% procedurally , in the past in older version of prman i have always find that raytracing refractive stuff throw isosurface is not always a good idea because rendertime can became crazy. well it's mantra not prman but they are close.

 

I would try to work as much as i can throw SOPs to draw and animate my form that way , by combining :

- manual modeling / layout

- conversion of those model throw volume

- work on those volume procedurally throw VOP/VEX sop

- convert those final volume to a mesh throw VDB Liquid mesher

- post process those poly mesh to optimise topology and tweak aspect ( you can also have nice UV's this way)

- work on a nice displacement shader with pattern animation

 

The fact that you will work on poly mesh generated procedurally will give you better control on the outpout you get and reduce the incertitude introduce when you do things 100% procedurally with CVEX.

 

I would then prepare a custom shader with displace / reflection / refraction and i would try to modify index of refraction / true - fake reflection / displace sampling throw Z by using getraylevel(). for exemple

- ior is replace by transparency after certain distance

- reflection is replace by environment reflection after certain distance

- displace is bump after certain distance

 

At the end what you throw to mantra is just a polygon mesh + custom surface shader.

I think the path will be easier and more controllable / predictable / open to optimisation this way but i also might be wrong ?

 

That's still doesn't answer your very interesting question , how to optimize marching step threw Mantra ... but for this one you need eetu or miles !

 

Cheers

 

E

Edited by sebkaine
Link to comment
Share on other sites

Hmm so your saying to generate a vdb and apply a volumeSop with my CVEX on it ? wouldn't that require me to crank up the voxel count to get de fine detail ?

 

yeah, you'd need to crank your samples, but vdb's are sparse.  since you're only concerned with the isosurface and not the intermediate volume, you could crank the vdb resolution, but only concentrate it on the surface area.

 

volume vops run on vdb's only run on the active vdb voxels, so what you could do is run your vex code on a traditional volume at a lowish resolution, then convert that to a vdb and then increase the resolution which will only rez up the active voxels.  then you can run your vex code on that to generate your high rez details without generating boatloads of data.  not sure what kinds of numbers you're having to deal with, but it might work.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...