Geometry Nodes: Ray Cast Node #88078

Closed
opened 2021-05-06 14:58:46 +02:00 by Jacques Lucke · 15 comments
Member

We decided to have a separate Ray Cast node and not to have it as a mode in the Attribute Transfer node. The main reason is that the functionality is conceptionally quite different on the user level and that it needs a different set of inputs.

Inputs:

  • Geometry
  • Source Geometry
  • Ray Direction (vector or attribute)
  • Max Ray Length?
  • Hit Position result attribute (vector)
  • Hit result attribute (boolean)
  • Attribute to transfer (can be a string list in the future, for now just one attribute)

Outputs:

  • Geometry

The exact name of the input sockets still has to be determined.

We decided to have a separate Ray Cast node and not to have it as a mode in the Attribute Transfer node. The main reason is that the functionality is conceptionally quite different on the user level and that it needs a different set of inputs. Inputs: * Geometry * Source Geometry * Ray Direction (vector or attribute) * Max Ray Length? * Hit Position result attribute (vector) * Hit result attribute (boolean) * Attribute to transfer (can be a string list in the future, for now just one attribute) Outputs: * Geometry The exact name of the input sockets still has to be determined.
Author
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath

@JacquesLucke is the Max Ray Length something(when set wisely) what can lead to a better performance of the node?

@JacquesLucke is the Max Ray Length something(when set wisely) what can lead to a better performance of the node?
Author
Member

Yes, also it could help to avoid artifacts when you don't want to ray cast onto some geometry that is far away accidentally.

Yes, also it could help to avoid artifacts when you don't want to ray cast onto some geometry that is far away accidentally.

Added subscriber: @GregoryS

Added subscriber: @GregoryS
Contributor

Added subscriber: @Eary

Added subscriber: @Eary
Contributor

What does this ray cast node do? The only ray cast feature I know is like the DoF Picker in camera view, which just detects the distance between the camera and the object (and IMHO this really needs a more obvious UI buttom). Is this node doing something similar? Detect distance between objects or something? I am not quite sure

What does this ray cast node do? The only ray cast feature I know is like the DoF Picker in camera view, which just detects the distance between the camera and the object (and IMHO this really needs a more obvious UI buttom). Is this node doing something similar? Detect distance between objects or something? I am not quite sure
Contributor

Added subscriber: @KenzieMac130

Added subscriber: @KenzieMac130

Added subscriber: @bent

Added subscriber: @bent

In #88078#1157095, @Eary wrote:
What does this ray cast node do? The only ray cast feature I know is like the DoF Picker in camera view, which just detects the distance between the camera and the object (and IMHO this really needs a more obvious UI buttom). Is this node doing something similar? Detect distance between objects or something? I am not quite sure

I believe it should shoot for every point in the input geometry a ray into the source geometry and copy the attribute value on the source geometry at the hit position onto the point from which the ray was shot

> In #88078#1157095, @Eary wrote: > What does this ray cast node do? The only ray cast feature I know is like the DoF Picker in camera view, which just detects the distance between the camera and the object (and IMHO this really needs a more obvious UI buttom). Is this node doing something similar? Detect distance between objects or something? I am not quite sure I believe it should shoot for every point in the input geometry a ray into the source geometry and copy the attribute value on the source geometry at the hit position onto the point from which the ray was shot
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Lukas Tönne self-assigned this 2021-06-12 11:49:37 +02:00
Member

I've started working on this.

One question about naming: I assume the "Geometry"/"Source Geometry" names are based on the attribute transfer node? For raycasting i would call these something like "Geometry" (where the rays come from) and "Cast Geometry" (that the rays are projected onto). "Source" would be confusing IMO since the rays are cast onto it, even though technically it is still the source of returned values like hit points, normals, interpolated values. Any other naming preferred?

I've started working on this. One question about naming: I assume the "Geometry"/"Source Geometry" names are based on the attribute transfer node? For raycasting i would call these something like "Geometry" (where the rays come from) and "Cast Geometry" (that the rays are projected onto). "Source" would be confusing IMO since the rays are cast onto it, even though technically it is still the source of returned values like hit points, normals, interpolated values. Any other naming preferred?

Hi @LukasTonne, while testing up Raycast node branch I realized that a handy option could make into the final node. Similar functionality already exists in Shrinkwrap modifier(Project method == raycast) which allows user to raycast in both directions(Positive/Negative see screenshot).

In the scenario below I'd like to project(cast) points generated on a plane onto the terrain. For the points to the right from red line(above terrain) I'd use Raycast node with ray direction set to (0,0,-1) and then use hit distance to offset/snap them to the terrain. Currently for the points to the left(below terrain), I need to first filter them based on Hit attribute with Point Separate node(all False ones), then plug another Raycast node now with ray direction set to (0,0,1) and do the rest again. I tested this workflow in the current branch and it works fine, but I think that such scenario can be done easily with just one Raycast node.

It'd be much more handy to have boolean option eg. "Negative as well" which when set to True would do raycast in both direction, in the first loop along the vector set in Ray direction, then second loop(not hit in the first loop) in the opposite direction. Then Hit distance attribute would return positive distances for points hit in the first loop and negative distances from the second loop. What do you think?
image.png

Hi @LukasTonne, while testing up Raycast node branch I realized that a handy option could make into the final node. Similar functionality already exists in Shrinkwrap modifier(Project method == raycast) which allows user to raycast in both directions(Positive/Negative see screenshot). In the scenario below I'd like to project(cast) points generated on a plane onto the terrain. For the points to the right from red line(above terrain) I'd use Raycast node with ray direction set to (0,0,-1) and then use hit distance to offset/snap them to the terrain. Currently for the points to the left(below terrain), I need to first filter them based on Hit attribute with Point Separate node(all False ones), then plug another Raycast node now with ray direction set to (0,0,1) and do the rest again. I tested this workflow in the current branch and it works fine, but I think that such scenario can be done easily with just one Raycast node. It'd be much more handy to have boolean option eg. "Negative as well" which when set to True would do raycast in both direction, in the first loop along the vector set in Ray direction, then second loop(not hit in the first loop) in the opposite direction. Then Hit distance attribute would return positive distances for points hit in the first loop and negative distances from the second loop. What do you think? ![image.png](https://archive.blender.org/developer/F10174846/image.png)
Member

In #88078#1177624, @MiroHorvath wrote:
Hi @LukasTonne, while testing up Raycast node branch I realized that a handy option could make into the final node. Similar functionality already exists in Shrinkwrap modifier(Project method == raycast) which allows user to raycast in both directions(Positive/Negative see screenshot).

In the scenario below I'd like to project(cast) points generated on a plane onto the terrain. For the points to the right from red line(above terrain) I'd use Raycast node with ray direction set to (0,0,-1) and then use hit distance to offset/snap them to the terrain. Currently for the points to the left(below terrain), I need to first filter them based on Hit attribute with Point Separate node(all False ones), then plug another Raycast node now with ray direction set to (0,0,1) and do the rest again. I tested this workflow in the current branch and it works fine, but I think that such scenario can be done easily with just one Raycast node.

It'd be much more handy to have boolean option eg. "Negative as well" which when set to True would do raycast in both direction, in the first loop along the vector set in Ray direction, then second loop(not hit in the first loop) in the opposite direction. Then Hit distance attribute would return positive distances for points hit in the first loop and negative distances from the second loop. What do you think?
image.png

This sounds like feature creep to me. It's a pretty specific scenario and i want to keep the number of options as low as possible. The raycast node is already quite big. A feature like this could just as well be done with a node group and have more flexibility too, with no additional perf cost because it would do two independent raycasts anyway.

> In #88078#1177624, @MiroHorvath wrote: > Hi @LukasTonne, while testing up Raycast node branch I realized that a handy option could make into the final node. Similar functionality already exists in Shrinkwrap modifier(Project method == raycast) which allows user to raycast in both directions(Positive/Negative see screenshot). > > In the scenario below I'd like to project(cast) points generated on a plane onto the terrain. For the points to the right from red line(above terrain) I'd use Raycast node with ray direction set to (0,0,-1) and then use hit distance to offset/snap them to the terrain. Currently for the points to the left(below terrain), I need to first filter them based on Hit attribute with Point Separate node(all False ones), then plug another Raycast node now with ray direction set to (0,0,1) and do the rest again. I tested this workflow in the current branch and it works fine, but I think that such scenario can be done easily with just one Raycast node. > > It'd be much more handy to have boolean option eg. "Negative as well" which when set to True would do raycast in both direction, in the first loop along the vector set in Ray direction, then second loop(not hit in the first loop) in the opposite direction. Then Hit distance attribute would return positive distances for points hit in the first loop and negative distances from the second loop. What do you think? > ![image.png](https://archive.blender.org/developer/F10174846/image.png) This sounds like feature creep to me. It's a pretty specific scenario and i want to keep the number of options as low as possible. The raycast node is already quite big. A feature like this could just as well be done with a node group and have more flexibility too, with no additional perf cost because it would do two independent raycasts anyway.

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#88078
No description provided.