Page 3 of 6

Re: (Open)Subdiv and Displacement shapes

Posted: Tue Oct 15, 2019 6:13 pm
by Dade
B.Y.O.B. wrote: Tue Oct 15, 2019 4:07 pm By the way, what happens to the intermediate shapes after the session is started?
When doing subdivision + displacement, we have:
- original mesh (no longer needed if not instanced)
- subdivided mesh (no longer needed)
- displaced mesh (needed during render)

Maybe more, due to e.g. pointiness.
Are the meshes that are no longer needed for the render deleted automatically by LuxCore, or does the caller (e.g. the Blender addon) have to delete them with scene.RemoveUnusedMeshes()?
In general, LuxCore never remove a binding (name => texture/material/shape/object/etc.) if not explicitly instructed so, even if it is not used in the scene at the time. You have to explicitly delete the item or just always call RemoveUnused*() before to start the rendering session.

Note: As you see, displacement is done at parsing/loading time so a Displacement Shape will not be updated if you edit the texture (for instance for real-time view port rendering) during the rendering. However if you redefine the Displacement shape (without having called RemoveUnusedMeshes()/RemoveUnusedTextures()), the mesh will be updated.
You probably want to call all RemoveUnused*() for final rendering while keep the intermediate steps alive for view-port rendering so you can edit the texture and update the Displacement shape.

Re: (Open)Subdiv and Displacement shapes

Posted: Tue Oct 15, 2019 8:58 pm
by B.Y.O.B.
ok, thanks for the explanation.

Re: (Open)Subdiv and Displacement shapes

Posted: Fri Oct 18, 2019 3:02 pm
by kintuX
This looks so good, hopefully i can test it over the weekend.

Q: Is or will Volume Displacement be possible?

For example - Lee Griggs's Volume Mesh

Image

Re: (Open)Subdiv and Displacement shapes

Posted: Fri Oct 18, 2019 3:45 pm
by Dade
kintuX wrote: Fri Oct 18, 2019 3:02 pm Q: Is or will Volume Displacement be possible?

For example - Lee Griggs's Volume Mesh

Image
It looks more like something for an OpenVDB file to me: viewtopic.php?f=5&t=212 (yes, it you follow the link it has been done with volumes in Arnold too).

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 9:47 am
by Dade
I have added the support for limiting the subdivision level based on triangle screen size.

".maxedgescreensize" can be used to stop the subdivision before having reached ".maxlevel". It is expressed in size on the film image plane (i.e. a value between 0.0 and 1.0). It is trivial to translate in pixels by multiplying by "max(film width, film height). This is an example:

Code: Select all

scene.shapes.obj_redply.type = mesh
scene.shapes.obj_redply.ply = scenes/bump/mat_red.ply
scene.shapes.obj_red.type = subdiv
##
scene.shapes.obj_red.source = obj_redply
scene.shapes.obj_red.maxlevel = 5
scene.shapes.obj_red.maxedgescreensize = 0.1
See how moving the camera away reduced the amount of scene triangles (i.e. stops after 3, 2 and 1 subdivisions):

subdiv3.jpg
subdiv2.jpg
subdiv1.jpg

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 10:30 am
by Racleborg
This is great! Thank you. :D

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 11:21 am
by Sharlybg
Is it equal to Blender cycles adaptive microdisplacement features ?

Image

Image

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 1:07 pm
by Dade
Sharlybg wrote: Thu Oct 24, 2019 11:21 am Is it equal to Blender cycles adaptive microdisplacement features ?
It is about subdivision. The subdivision is still uniform (to be than usable with displacement) but the level is based on triangle edges screen size.
The one you posted was available in old Lux, it was so slow to make people cry.

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 1:54 pm
by B.Y.O.B.
Sharlybg wrote: Thu Oct 24, 2019 11:21 am Is it equal to Blender cycles adaptive microdisplacement features ?
From what I know, Cycles can adaptively tessellate each face of a mesh depending on camera distance.
Dade's example shows something similar, but it currently works per whole mesh, not per face.
So for example, with Cycles you could use one huge plane for the pebbles image you posted, and the parts of the plane that are close are tessellated more than the parts of the plane in the background. Lux currently would tessellate the whole plane uniformly.
Dade wrote: Thu Oct 24, 2019 1:07 pm The one you posted was available in old Lux, it was so slow to make people cry.
Cycles does not have microdisplacement like old LuxRender had (tessellation done at render time for each ray, saving tons of RAM).
What they call "microdisplacement" in Cycles is just regular adaptive tessellation and displacement, it needs lots of RAM.

Re: (Open)Subdiv and Displacement shapes

Posted: Thu Oct 24, 2019 2:42 pm
by Sharlybg
Cycles is just regular adaptive tessellation and displacement
This is what i was asking. thanks for the explanation.