Read volume or point cloud in shader

   3497   5   0
User Avatar
Member
166 posts
Joined: March 2014
Offline
Hello,

I have a grid and an SDF VDB sphere. I want to make a shader for the grid whose color is based on the sphere's SDF value.

When building a simple VOP network in SOPs that takes a volume sample and applies it as Cd onto the grid, everything works fine. However, when I take this exact same network and use it as a shader, it does not work.

I reference the volume via opobj/sphere1, and I read elsewhere that /mat/ can't handle op referencing this way. But even when wrapping the shader into a material network and feeding it the op path via an exposed parameter it still doesn't work. Mantra keeps saying something about “unable to resolve geometry opobj/sphere1. Please ensure the object is included for rendering.”

I tried using a point cloud instead: I scattered points into the volume and stored the SDF values on the point cloud. Again, colorizing the grid in SOP land by using a point cloud open and pointing it to opobj/sphere1 works fine. But the same nodes fail in MAT land. Does anybody know how to get this to work?
Edited by Digipiction - March 22, 2018 17:10:28
User Avatar
Member
74 posts
Joined: Dec. 2009
Offline
In shader/render, it is in camera space, you need to transform the sampling position to world space when sampling the vdb at shader.
https://www.linkedin.com/in/kelvincai/ [www.linkedin.com]
User Avatar
Member
166 posts
Joined: March 2014
Offline
Unfortunately this doesn't help, I must be making a silly mistake somewhere. I made a brand new scene from scratch, it's super simple and I can't find anything wrong with, except it doesn't work.

Attachments:
samplingPC.hiplc (269.7 KB)

User Avatar
Member
18 posts
Joined: June 2016
Offline
Hi there,

the difference between point clouds in Sop and in Mat are that Sop is always aware of other existing nodes while Mat is not because you are now in shader land not in geometry land anymore.
The solution is simply to cache out the geometry you would like to use as a point cloud in Mat/Shop and refer to the file instead to a sop in the shader.

If you take that into account, it works.


Cheers
Jakob

Attachments:
samplingPC_fix.hipnc (271.9 KB)
point_cloud.JPG (20.9 KB)

User Avatar
Member
166 posts
Joined: March 2014
Offline
Innehavaren
The solution is simply to cache out the geometry you would like to use as a point cloud in Mat/Shop and refer to the file instead to a sop in the shader.
Thank you very much for looking into it! Unfortunately, I need a live solution that doesn't require caching. This is for an HDA that has multiple parameters to tweak the look.

Some of these parameters change the VDB or the point cloud, so they must be readable by the shader without caching them first.
User Avatar
Member
18 posts
Joined: June 2016
Offline
GoetzingerC
I need a live solution that doesn't require caching. This is for an HDA that has multiple parameters to tweak the look.

I see your point. But I don't know if there's a way to achieve this at all. My experience taught me that point clouds are very picky where the data is coming from.
  • Quick Links