3Delight/Blender

the file you’ve posted is only containing the cube and the material assigned to it.
To render a scene you need to export the whole scene with camera, projection, lights, how to create the image and where to place it, etc.

In renderman it’s perfectly legal to split all these infos up into several files to get a better structure and reuse parts of it without having to reexport them.

A useful example would be:
You have a scene with millions of polygons. Exporting these would take several minutes or even more, say half an hour.
Rearranging your light setup would normaly force you to wait for all the geometry to be reexported each time wasting a lot of time.

Another example is you want your scene to be responsive while arranging extremely complex objects. You could model/export all the complex geometry separately and then do the arrangement in another file with dummyobjects. You could then open a text editor and edit your .rib file containing the world data manually and replace all the places where dummy rib files are referenced with the complex ones. The reyes engine usually has much less trouble rendering the data than the opengl renderer in blender (given you avoid raytracing).

tobra: to reiterate what frigge said, you’ve probably exported a RIB archive using File -> Export. That will just export the selected objects to a single RIB file, which can be included in another RIB file later on. To get the full scene, just hit render :slight_smile:

Ack, I need help!

I just can’t figure out how to access multiple uv coordinates in a shader…

Exporting them is easy with the “primitive variables” setup in the mesh properties tab, but how do I access them in a shader?

For weight maps it all works by just adding a varying float of the name of the primitive variable to the shader…

eg
varying float myVariable = 0.5;
and that works a treat.

the second set of UV texture coordinates are
“facevarying float[2] st2”
in the rib file.

Because that’s an array how do I declare and access s2 and t2 in a shader?
I’ve tried lots of combinations for declaring and accessing, but feel really stupid that none of them work.
s and t “just work” as they are built in…

The only examples I can find through google are for maya which exports s2 and t2 as separate floats rather than as an array so the same treatment as for blender weights works there…

so how do I declare the variables and how do I access the components of teh array individually…
(I never did learn C!)

Broken, a couple of bugs:
I noticed that if you have a subd modifier it exports the modified(subdivided) data, not the base cage… handy for using in a stack, but currently the UVs are being corrupted by this.

Workaround is easy: I set primitive type to subdivision in the objects tab and set the modifier to not render.

Also, shaders aren’t compiling from the text editor in svn-trunk… more api changes I guess. Works fine in 2.59!

re. primitive variables, I think you should be able to just declare them as shader parameters. For example, if you add a vertex color primvar, and name it ‘specularcolor’, then in the plastic shader, it will read it in as the specular colour.

reg. subd, yes the API now prevents modifying blender data at render time unfortunately :frowning: I used to use this to disable subd modifiers at render time but it’s not possible any more. You just have to use the primitive type I’m afraid, or disable the modifier for rendering. Hopefully this can be fixed soon.

I just tried compiling a shader here, it seemed to go ok but I haven’t updated SVN lately - will update and check.

btw, I fixed the shader parameter ordering issue, will hopefully be able to release with some other updates soon.

Thanks Broken,

yes, I got primitive variables working fine as you say, it’s just the uv case that I can’t get working… it’s an array… I can’t seem to declare it

I got it working ok like this: http://www.pasteall.org/pic/17679

However! I found another bug where it doesn’t seem to like float parameters with 2 elements - I’ve fixed that locally, but it may not work too well in your case until an update :frowning:

Thanks Broken, works fine until I re-open the scene! then it can’t initialise something…

Looking forward to an update! I’m becoming addicted to this :slight_smile:
Still lots to learn but getting there!

So what exactly is the work flow for compiling shaders on-the-fly from the text editor? Do I just name my text document like myShader.sl and then type the name of it in manually? Does the preview work too?

The shader text file needs to be saved somewhere in your shader path with the .sl extension, that way the compiled shader (.sdl)will get made in that directory. From then on no need to re-save after changes, just rightclick and compile… then the shader will reload when you hover the mouse over the material properties.

If you do add or remove variables you may need to save and reload the file for the UI to catch up.

Oh, and the preview updates after the shader is re-loaded.

You can also click on the little ‘refresh’ button next to the shader name.

Anyone feel like copying and pasting this into a basic doc? :stuck_out_tongue:

Ok, I’ll put something together covering this and some other topics…
Will send to you for an accuracy check when done :wink:

@michael: Thanks I will try that out.

@matt: I was playing around with the exporter today and noticed something. I created a cube to be a lampshade. I put a light inside it. I added them to a group and moved them to an unrendered layer. Then I added empties to my main scene and dupligrouped the lamp a few times. The exporter did create the correct mesh part of a group but it did not export the lamp part of the group. Perhaps you have already found this one and fixed it. But I thought I’d report it anyway.
Here is the scene. But I had to manually create the lights.
/uploads/default/original/3X/5/2/527c2a0914cf52184d92e377eb2a7b4643cd3d6a.jpgstc=1&thumb=1&d=1315586692

Atom, you could always export your group as a rib archive and then reference it by using any object as a placeholder… in the “properties -> object tab --> geometry source” you can choose “Archive”

I know that’s not what you were reporting, but I love the simplicity and flexibility of this!
Especially for team work or just saving export time on complicated geometry when working on lighting…

@frigge
@broken
Thank you for the info and your patience with a 3Delight newbie - now it works :slight_smile:

Hi Broken, your plug in looks amazing!! Thanks for working on this. Is it far enough along that it could be considered for baking light maps for use in either a game engine or blender’s internal renderer? I was told in a different thread that 3delight “could” bake light maps but the process was too complicated for a dumb artist like me. :slight_smile:

@MichaelW: I like the idea. Renderman dupligrouping, or RIB instancing. Basically I do not get any outputted RIB file for my archive source. How do I generate the archive source?

Here is what I have done. My lantern is made up of three objects. A pointlight in side a cube, a cube as the lamp shade, and a mesh as the lantern mount. So I clicked on those objects and activated the Export as Archive check box for each one. I type in the name “my_lamp.rib” into the Archive Export Path. I have already set my Archive path under Render Settings. So is the 3Delight exporter smart enough to know how to put all three parts into the same archive file? What triggers the archive process? Is that done upon render?

On the other side, I have three empties that have their Geometry Source set to Archive. I have typed in “my_lamp.rib” for that Archive Path.

@atom: thanks for the heads-up. I haven’t got the code in front of me, but from memory the dupligroup export only considers geometry, not lights. In general the light export is quite separate from the geometry export, so it may be that lights won’t even appear in archives either - I’ll have to re-examine that.

As for archives in general, If you want to export a collection of selected objects together, you can export them manually with file->export->rib archive. The auto-export at render time will currently just work with a single object that it’s enabled for. It’s good to hear feedback like this - since this stuff was added I haven’t been able to test it myself in a practical scenario. It might be good to look into automatically archiving groups too, and automatically referencing them when rendering dupligroup objects.

@fahr: light maps hasn’t been a very high priority use case so far, mainly because so many of the advantages of renderman are in rendering main beauty passes (dof, motion blur, displacement, etc) - light maps aren’t really playing to its strengths :slight_smile: There’s also not too much in the way of fancy lighting supported by this exporter at this point, but that’s steadily improving. But regardless, even though there’s no automatic system for it as yet, baking should certainly be already possible, it just requires a custom shader to do it. You use the bake() function to save the data out to file, and then the tdlmake utility to convert that bake file to a texture map.

See here for info/examples: http://www.3delight.com/en/uploads/docs/3delight/3delight_42.html#SEC178

I was struggling to get subsurface scattering to work.
rendering the tmp output on the commandline using renderdl I noticed an error:

3DL ERROR R2086: incomplete (or invalid) parameters set for subsurface scattering (in shader ‘simple_ss’ on object ‘Monkey’)

Comparing a blender exported rib to the one in 3delight’s examples folder

Blender:


        Attribute "visibility" "string subsurface" "Material.001" 
        Attribute "subsurface" 
            "color meanfreepath" None 
            "refractionindex" 1.2999999523162842 
            "shadingrate" 8.0 
            "scale" 0.0010000000474974513 
         

examples:


        Attribute "visibility" "string subsurface" "marble"
        # parameters taken from the original BSSRDF paper.
        Attribute "subsurface"
            "scattering" [2.19 2.62 3.00]
            "absorption" [0.0021 0.0041 0.0071]
            "refractionindex" 1.5
            "shadingrate" 16
            "scale" .1


manually editing the blender rib to add scattering and absorption parameters and rendering it on the command line through renderdl works fine…

Now, am I missing where to set these or is it just a bug?

meanfreepath vs scattering/absorption are two alternative forms, you can use either and it should be fine. The ‘None’, though, is a bit worrying - let me have a look…

Edit: Fixed.