Hello,
I'm wanting to do some work with procedural objects and I'm looking at LuxCoreRender. I'm trying to render planets, and want things like procedural clouds and atmospheric effects. See http://cowlark.com/flooded-moon/ for some pictures (done with Povray).
Does LuxCoreRender have the ability to call arbitrary user functions in order to evaluate textures or volumetric density functions? Either as a callback if I'm using the C++ API, or via a dynamically loaded DLL, or something similar. I'm aware this won't be GPU-friendly but I'm not particularly bothered by that.
I'm going to be doing standalone rendering with scenes created in code, so I don't care about Blender/Maya integration.
Procedural textures via a DLL or callback?
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Re: Procedural textures via a DLL or callback?
Yes and no:
- No because there are no callbacks, not during the pre-processing phase, nor during the rendering (however, as far I understand from your link, POV-ray has callbacks during the geometry pre-processing phase but not during the rendering).
- Yes because you can build your scene by using Python/C++: it is not LuxCore API to callback you but you to call LuxCore API to procedural build the scene.
For instance, this fragment of Python code create a scene with a plane and a distant light source (cut&paste from one of the API samples):
Your code could build the surface, instantiate the trees, etc. like it is described in the link.
- No because there are no callbacks, not during the pre-processing phase, nor during the rendering (however, as far I understand from your link, POV-ray has callbacks during the geometry pre-processing phase but not during the rendering).
- Yes because you can build your scene by using Python/C++: it is not LuxCore API to callback you but you to call LuxCore API to procedural build the scene.
For instance, this fragment of Python code create a scene with a plane and a distant light source (cut&paste from one of the API samples):
Code: Select all
def BuildPlane(objectName, materialName):
prefix = "scene.objects." + objectName + "."
props = pyluxcore.Properties()
props.SetFromString(
prefix + "material = " + materialName + "\n" +
prefix + "vertices = -1.0 -1.0 0.0 -1.0 1.0 0.0 1.0 1.0 0.0 1.0 -1.0 0.0\n" +
prefix + "faces = 0 1 2 2 3 0\n" +
prefix + "uvs = 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0\n"
)
return props
def CreateScene():
# Create the scene
scene = pyluxcore.Scene()
# Create the scene properties
scnProps = pyluxcore.Properties()
# Set the camera position
scnProps.SetFromString("""
scene.camera.lookat.orig = 0.0 5.0 2.0
scene.camera.lookat.target = 0.0 0.0 0.0
""")
# Define a white matte material
scnProps.SetFromString("""
scene.materials.whitematte.type = matte
scene.materials.whitematte.kd = 0.75 0.75 0.75
""")
# Add a plane
scnProps.Set(BuildPlane("plane1", "whitematte"))
# Add a distant light source
scnProps.SetFromString("""
scene.lights.distl.type = sharpdistant
scene.lights.distl.color = 1.0 1.0 1.0
scene.lights.distl.gain = 2.0 2.0 2.0
scene.lights.distl.direction = 1.0 1.0 -1.0
""")
scene.Parse(scnProps)
return scene
Re: Procedural textures via a DLL or callback?
Thanks, but I think that's not quite what I asked.
Povray has its own shader language, which you can use to implement procedural textures --- it's not very quick, because it's interpreted. For my own experiments I hacked in support for DLL textures in my own copy of Povray by using dlopen() to dynamically call out to external code. This allows textures to be generated procedurally on-the-fly. This is the functionality I'm looking for in LuxCore. Does it contain anything like this, or could it be easily added?
What this allows is defining shapes mathematically, or from external data sources. I mainly want this for planet-sized procedural volumetric clouds, where the density map is far too large to exist in memory, but you can do other cool things with it. For example, in Povray:
http://dataduppedings.no/subcube/POV-Ra ... _Noise.jpg
...that shape contains no geometry at all; the entire shape is a volumetric rendering based on a mathematical description of the shape (well, it's actually an isosurface, but it's essentially the same thing). For a more mind-blowing example, try this one:
http://news.povray.org/povray.binaries. ... 7&toff=800
There are no triangles at all in that image --- the source file which generated it contains a single isosurface and is about 20 lines long...
Povray has its own shader language, which you can use to implement procedural textures --- it's not very quick, because it's interpreted. For my own experiments I hacked in support for DLL textures in my own copy of Povray by using dlopen() to dynamically call out to external code. This allows textures to be generated procedurally on-the-fly. This is the functionality I'm looking for in LuxCore. Does it contain anything like this, or could it be easily added?
What this allows is defining shapes mathematically, or from external data sources. I mainly want this for planet-sized procedural volumetric clouds, where the density map is far too large to exist in memory, but you can do other cool things with it. For example, in Povray:
http://dataduppedings.no/subcube/POV-Ra ... _Noise.jpg
...that shape contains no geometry at all; the entire shape is a volumetric rendering based on a mathematical description of the shape (well, it's actually an isosurface, but it's essentially the same thing). For a more mind-blowing example, try this one:
http://news.povray.org/povray.binaries. ... 7&toff=800
There are no triangles at all in that image --- the source file which generated it contains a single isosurface and is about 20 lines long...
Re: Procedural textures via a DLL or callback?
You talk about "textures" but you always link renderings related to geometries. The question here is if POV-ray builds the linked geometries during pre-processing or on-the-fly during the rendering ?hjalfi wrote: ↑Wed Jan 17, 2018 10:12 am Povray has its own shader language, which you can use to implement procedural textures --- it's not very quick, because it's interpreted. For my own experiments I hacked in support for DLL textures in my own copy of Povray by using dlopen() to dynamically call out to external code. This allows textures to be generated procedurally on-the-fly. This is the functionality I'm looking for in LuxCore. Does it contain anything like this, or could it be easily added?
I have some doubt about the second because it would be very slow. For the second case, the answer is no because LuxCore is monotheistic and has only one God: the triangle.
For the first case (during the pre-processing), LuxCore has something similar with fixed functions: for instance, it can transform hairs descriptions in meshes or apply "pointiness" to meshes (http://www.luxrender.net/wiki/New_in_1-5#Pointiness).
It would be possible to add new function to call something external written in whatever you want. But, again, only during the pre-processing stage, not on-the-fly during the rendering.
Re: Procedural textures via a DLL or callback?
The two images I posted don't use geometry at all (other than the primitives used to contain the volumes being rendered). They're not rendered using triangles or meshes. They're (effectively) heterogeneous volumetric renderings based on a 3D texture, which is generated procedurally, which is why I'm asking about textures. I'm not interested in procedurally generating geometry, as it's easier and faster to just bake the geometry into a mesh and load it.
This is probably a clearer example:
http://news.povray.org/povray.binaries. ... ainers.png
The top image has volume rendering disabled and shows the raw geometry; the bottom one has volumetric rendering enabled. A 3D procedural texture supplies the density function for the heterogenous volume which makes up the cloud.
This is probably a clearer example:
http://news.povray.org/povray.binaries. ... ainers.png
The top image has volume rendering disabled and shows the raw geometry; the bottom one has volumetric rendering enabled. A 3D procedural texture supplies the density function for the heterogenous volume which makes up the cloud.
Re: Procedural textures via a DLL or callback?
Your question make me maybe discover How this earth render was done in tungsten gallery :The top image has volume rendering disabled and shows the raw geometry; the bottom one has volumetric rendering enabled. A 3D procedural texture supplies the density function for the heterogenous volume which makes up the cloud.
https://benedikt-bitterli.me/tungsten.html
Re: Procedural textures via a DLL or callback?
I did something similar in the past, but with the built-in voronoi texture: http://www.luxrender.net/forum/viewtopi ... 11#p119011
Re: Procedural textures via a DLL or callback?
I've been looking at Tungsten (and Mitsuba, too) --- it's a really nice picture. Tungsten's got a specialised heterogeneous atmospheric renderer which does Rayleigh shading; the clouds are volumetric, but it uses a height map for the source rather than a proper 3D density function. Both were designed specifically for that picture. Writeup here: http://noobody.org/is-report/advanced.html
I did produce a moon-from-space picture with Povray and volumetric procedural clouds, but it was broken and bandy and like an idiot I didn't save the source code. The only copy of the picture disappeared with twitpic (if anyone knows where the twitpic archive went, I want to see that picture again). It was creakingly slow to render.
Tungsten and Mitsuba are both really nice, and easy to hack, but I'd really like to find a modern renderer that supported volumetric procedural volumes via DLLs *without* having to patch in support myself. Hence my question...
I did produce a moon-from-space picture with Povray and volumetric procedural clouds, but it was broken and bandy and like an idiot I didn't save the source code. The only copy of the picture disappeared with twitpic (if anyone knows where the twitpic archive went, I want to see that picture again). It was creakingly slow to render.
Tungsten and Mitsuba are both really nice, and easy to hack, but I'd really like to find a modern renderer that supported volumetric procedural volumes via DLLs *without* having to patch in support myself. Hence my question...
Re: Procedural textures via a DLL or callback?
Can we see the POV-Ray code for that mind-blowing city example?
Thank you
Andy
Thank you
Andy
hjalfi wrote: ↑Wed Jan 17, 2018 10:12 am Thanks, but I think that's not quite what I asked.
Povray has its own shader language, which you can use to implement procedural textures --- it's not very quick, because it's interpreted. For my own experiments I hacked in support for DLL textures in my own copy of Povray by using dlopen() to dynamically call out to external code. This allows textures to be generated procedurally on-the-fly. This is the functionality I'm looking for in LuxCore. Does it contain anything like this, or could it be easily added?
What this allows is defining shapes mathematically, or from external data sources. I mainly want this for planet-sized procedural volumetric clouds, where the density map is far too large to exist in memory, but you can do other cool things with it. For example, in Povray:
http://dataduppedings.no/subcube/POV-Ra ... _Noise.jpg
...that shape contains no geometry at all; the entire shape is a volumetric rendering based on a mathematical description of the shape (well, it's actually an isosurface, but it's essentially the same thing). For a more mind-blowing example, try this one:
http://news.povray.org/povray.binaries. ... 7&toff=800
There are no triangles at all in that image --- the source file which generated it contains a single isosurface and is about 20 lines long...
Re: Procedural textures via a DLL or callback?
I got it from this thread: http://news.povray.org/povray.binaries. ... 7&toff=800 I do remember seeing a copy of the source the last time I looked into this, but I don't have it and I think the website which hosted it has gone down.
Speaking of which, I see that luxrender.net is now advertising shoes.
Speaking of which, I see that luxrender.net is now advertising shoes.