Reflection stored as a point attribute

   623   4   0
User Avatar
Member
5 posts
Joined: April 2015
Offline
Hello there,


I wondered if there's a way to store the reflection color as a point attribute. Let's imagine we have a grid that reflects some objects that stand on top of it. Can this data be written onto the grid points as Cd?


I don't know what the procedure can look like for that kind of thing except for rendering the whole thing first and then re-projecting the rendered image with camera mapping on top of everything. I'm wondering if this all can be solved directly with nodes?
Edited by lecaro - Jan. 4, 2024 05:58:28

Attachments:
Screenshot 2024-01-04 135352.png (1.2 MB)

User Avatar
Member
242 posts
Joined: Jan. 2008
Offline
Do you want to store the rendered color or just fetch the Cd attribute from the object in SOPs?

First one you need to evaluate the shader and this can only be done at rendertime. In mantra you can bake shading samples to point clouds. Its a bit involved and Im not sure it works in karma.

Second option is doable with vex and some math.
1. From each point calculate a vector to camera.
2. use the reflect function/vop to calculate reflection vector
3. send a ray in that vector using intersect function/vop and look for a hit.
4. fetch Cd attribute from hit surface.
Might be able to build you a example for this later if I find time.
User Avatar
Member
5 posts
Joined: April 2015
Offline
mawi
Do you want to store the rendered color or just fetch the Cd attribute from the object in SOPs?

First one you need to evaluate the shader and this can only be done at rendertime. In mantra you can bake shading samples to point clouds. Its a bit involved and Im not sure it works in karma.

Second option is doable with vex and some math.
1. From each point calculate a vector to camera.
2. use the reflect function/vop to calculate reflection vector
3. send a ray in that vector using intersect function/vop and look for a hit.
4. fetch Cd attribute from hit surface.
Might be able to build you a example for this later if I find time.

Oh, that's clever. I guess there's no real point in baking then, easier to just re-project. But the Second option might be the case for me. Would highly appreciate an example! Until then will try to dig into that myself
User Avatar
Member
242 posts
Joined: Jan. 2008
Offline
Here Im fetching Cd. But you might as well get the uv atribute from the hit and apply the color map to the scattered point.

did a example using the ray node to send several jittered rays aswell.

There are examples floating around with "complete" pathtracers done in SOPs.

Attachments:
reflSOPs.hipnc (447.6 KB)

User Avatar
Member
5 posts
Joined: April 2015
Offline
mawi
Here Im fetching Cd. But you might as well get the uv atribute from the hit and apply the color map to the scattered point.

did a example using the ray node to send several jittered rays aswell.

There are examples floating around with "complete" pathtracers done in SOPs.

Wow, you even got some sort of Roughness. That's more than enough for me, thank you for your time. I didn't even think that it could be solved in such a short node-tree.
  • Quick Links