vrmeshs (aka proxy)

What?

Briefly: You know the principle of texture tiling? (No? Hop! Hop! Hop! (french) :Nannan: ) Well, principle is the same, but for geometry: Vrmesh are "ready to raycast" meshes. Geometry is stored in a grid (voxel).

So you only load necessary "box" to render. Your vrmesh can be huge, only the elements necessary for the calculation will be loaded/unloaded on the fly. As well as tiled maps, this increase your disk IO but gives you great flexibility.

Don't be afraid because of the size, vrmesh are done for! :D

Practice

Let's do simple, here is a scene with to 24 frame animation cycles:

user_attr_vray_001.png

You can't see it but they are walking! :onSeFendLaPoire:

At this step, principle is to assign, to each "shader group", an ordinary shader (lambert is fine). Name is the importante part because it will be stored in the vrmesh with it assigned faces:

user_attr_vray_002.png

"lambert5" should have been "arms" but I've completely missed it. :baffed:

Even though this is not required, try to keep coherence in names between all your objects. So, if you have characters crowd to export. Assign them all shaders "arm", "corp", "head", "Hair", "tenuHaut", "tenuBas", etc ... With a bit of script, you will save time later.

Select mesh group you want to export:

user_attr_vray_003.png

Then go in Create/V-Ray/Create proxy:

user_attr_vray_004.png

You will have a horrible quite sober interface:

user_attr_vray_005.png

Select Export animation. If your mesh is animated and you plan to use motion blur on your final render, select Export velocity. The two values will create the interval to calculate direction vectors to be stored in the vertices. VRay will calculate the motion blur geometry from this informations. Be careful on this interval. You can expect some (bad) surprises. If you don't go with motion blur, deselect this option. This will store less information in the geometry.

In my case I also select Use playback range but advise accordingly to your case. :reflechi:

With Face in preview, Chaos Group provide us what look like a small and trivial feature but very interesting in practice: The idea is to save n face indices that will be displayed in the viewport later.

When doing proxy, mainly to lighten a scene, we often have to manage large bouding box. Depending on the pipeline, you may even have a proxy made by another department. Here, Chaos Group guys had a very interesting reflection: "Why not make a cool proxy corresponding to the real geometry?". The bet is entirely successful, you will see that later. :)

If you want to import directly the newly created proxy, you can select Automatically create proxies.

For the rest, I strongly advise you to read the documentation.

Once that's done, click on Create Proxy!

Proceed this steps for every characters you want to export.

:longBar:

To import all this:

user_attr_vray_006.png

user_attr_vray_007.png

Tadaaaa:

user_attr_vray_008.png

user_attr_vray_009.png

And now our 100 faces per object. Slap it right? :aupoil:

Seriously, you can import hundreds of them, your viewport does not flinch. In addition, these proxies correspond to the final model. This approximation should less bother you than a low model or worse, a bounding box.

Now let's look at this options:

user_attr_vray_010.png

If we select Bounding box:

user_attr_vray_011.png

For nostalgic. :trollface:

If you are not satisfied with the approximation, Chaos Group has got you covered: Show whole mesh:

user_attr_vray_012.png

Other options are more specific. I will not go into detail. If you're interested: :RTFM:.

Just notice animation speed is customisable (anim is possible too! :gniarkgniark: ) and that in our case (and most cases) it's Loop.

Go tabs on the right. VRay has already connected a shader and...

user_attr_vray_013.png

Oh miracle! Our slots are there! :laClasse:

You will just have to drag and drop shaders to use.

Note that trying too hard to be nice, VRay create a shader for each imported vrmesh. But if you import twice the same vrmesh, you will have two similar shaders. Don't hesitate to remove one and apply a single shader for each vrmesh "source".

Now let's get serious! :enerve:

User Attributes

Select the transform node of one vrmesh you have and add User attributes:

user_attr_vray_014.png

In these User attributes (lost at the bottom of your Attribute Editor) add the following:

casquetteColor=1,1,0;

user_attr_vray_015.png

There, you should begin to understand. :siffle:

On the second, create a similar value:

user_attr_vray_016.png

Now create a shader, a blinn in my example (Yes, I know it's bad). Give it a clear name (it will quickly become a mess in your connections so it's up to you :redface: ):

user_attr_vray_017.png

Add a VRayUserColor node then enter your attribute value:

user_attr_vray_018.png

user_attr_vray_019.png

Set the default color you want. It will be the color used if User Attribute is not present/valid.

You have some syntax examples just below the node (another good idea).

Connect this node to the color attribute of your shader (it's a shame the default color is not used in the hypershade, it would be a nicer than a black hole).

user_attr_vray_020.png

Connect your shader to both VRayMeshMaterial, in the "casquette" slot:

user_attr_vray_022.png

user_attr_vray_021.png

Then render:

user_attr_vray_023.png

Victory song (to listen with :smileFou: )

Do the same for all shaders (except "corp" that we keep for after :jdicajdirien: ):

user_attr_vray_024.png

user_attr_vray_025.png

Well, those are for colors. You can do the same with VRayUserScalar and floatting point value.

Now we start the body ("corp"):

user_attr_vray_026.png

Just a file node.

Supposing you have four textures:

  • checker_default.png
  • checker_four.png
  • checker_etc.png

The only variable in your texture is located at the end (and, why not, in the path).

Put this in your file path:

user_attr_vray_027.png

Then apply this variable to your different User Attributes:

user_attr_vray_028.png

user_attr_vray_029.png

Render!

user_attr_vray_030.png

Once again?

And if we have no limit: user_attr_vray_031.png

user_attr_vray_032.png

If you often do crowds, you should seriously consider this solution.

Notice

I think, as mental ray User Data, it's a bit cumbersome to deal with. But if you or your colleague is scripter, it is not too difficult to put it up on a production.

I breath the poppy it may (this is unconfirmed so take with a grain of salt) Deex (whom I thank for making me discover VRay) integrates a simple way to deal with them in Arsenal (but dont be too hasty :sourit: ).

Conclusion

I hope this tutorial will help you in your productions.

See you!

Dorian

:marioCours: