Jump to content

point instance displacement mapping


Recommended Posts

Hello all,

I'm using an instance node in point instance mode to copy the output of another sop onto it. The material has displacement on it but it seems to me that all the instances are being displaced in exactly the same way, i.e. the same deformation on every instance.

I am assuming that is because the noise values (that are used for the displacement) are being looked at in local space, how would I make it so that it was in global?

Also the object I am using to copy the instances onto has color attributes on the points but they are not inherited by the instances. Any suggestions how to accomplish this?

Many many thanks!

Link to comment
Share on other sites

there is instancepoint() expression which gives you ptnum of current point the geometry is instanced onto

you can use this in offset attribute for your displacement to randomize displacement for each point

in similar way you can lookup for color or other attributes on instance points

simply by putting something like:

point("../instance_points", instancepoint(), "Cd", 0)

point("../instance_points", instancepoint(), "Cd", 1)

point("../instance_points", instancepoint(), "Cd", 2)

in color parameter of surface shader on your instances

transforms can be automatically inherited by instances if certain attributes (like N, up, v, orient, rot, scale, trans) exist on instance points, more info is in help or in forums

Link to comment
Share on other sites

Have a look at the files attached in this post (all the way at the bottom).

http://www.peterclaes.be/blog/?p=34

They use the instancepoint() expression to look up which procedural shader to load,

using something along the lines of:

point("obj/my_template_pts",instancepoint(),"instancetype",0)

There is an example with lights that looks up the point color for the color of the light:

Inside of the light's color:

red: point("obj/my_template_pts",instancepoint(),"Cd",0)
green: point("obj/my_template_pts",instancepoint(),"Cd",1)
blue: point("obj/my_template_pts",instancepoint(),"Cd",2)

In the same way I think you could use an attribute on your shader "offset". And put the instancepoint() in the offset, not 100 % sure though as that would require the material settings to be changed and stored in the ifd file for each instance. You can check this in a ifd file. Otherwise you could create multiple shaders (with different offsets) and simply modify the paths to the shaders. If you had 5 shaders the shaderpath would become something like: /shop/my_shader_`instancepoint()%5`

But check the file, it does the same with delayed loads as procedural shaders.

Edit: ah, they beat me to it :)

Edited by pclaes
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...