Raycast "Is Hit" returns inconsistent result in Simulation Zone #110867

Closed
opened 2023-08-07 06:04:16 +02:00 by NDPZ · 4 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.79

Blender Version
Broken: version: 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: c7fc78b81ecb

Short description of error
Output "Is Hit" does not always return a hit when the position is animated through simulation nodes.

In the case shown in the video, the "Is Hit" does not always appear on the "Viewer Node" nor return hit for the node labeled "Switch (Teleport left and up)"
But it correctly seems to return "Is Hit" for the node labered "Switch (Reflect or keep CurrentVelocity)" (which changes direction of movement).

The intended behavior is for the points to accelerate downwards, and upon colliding with the plane: reflect the velocity along the plane's normal, and add the vector (0, 1, 1) to its position.
Instead, for the first few "collisions", only the reflection seems to occur (no teleport).

Exact steps for others to reproduce the error

  • Open attached .blend file
  • Click on the first Viewer Node (the one with the value linked to "Is Hit")
  • Run animation

Note that the point is correctly reflected (indicating that "Is Hit" works in this case).
But the point is not always teleported.

( ps: a spherecast node (thicker raycast) would be incredibly useful for simulations 😄. Unity implements these: https://docs.unity3d.com/ScriptReference/Physics.SphereCast )

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.79 **Blender Version** Broken: version: 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: `c7fc78b81ecb` **Short description of error** Output "Is Hit" does not always return a hit when the position is animated through simulation nodes. <video src="/attachments/626dce7f-730b-4600-ba86-af946e59667e" title="2023-08-06 23-36-32.mp4" controls></video> In the case shown in the video, the "Is Hit" does not always appear on the "Viewer Node" nor return hit for the node labeled "Switch (Teleport left and up)" But it correctly seems to return "Is Hit" for the node labered "Switch (Reflect or keep CurrentVelocity)" (which changes direction of movement). The intended behavior is for the points to accelerate downwards, and upon colliding with the plane: reflect the velocity along the plane's normal, and add the vector (0, 1, 1) to its position. Instead, for the first few "collisions", only the reflection seems to occur (no teleport). **Exact steps for others to reproduce the error** - Open attached .blend file - Click on the first `Viewer Node` (the one with the value linked to "Is Hit") - Run animation Note that the point is correctly reflected (indicating that "Is Hit" works in this case). But the point is not always teleported. ( ps: a spherecast node (thicker raycast) would be incredibly useful for simulations 😄. Unity implements these: https://docs.unity3d.com/ScriptReference/Physics.SphereCast )
NDPZ added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-08-07 06:04:17 +02:00
Iliya Katushenock added the
Interest
Geometry Nodes
Interest
Nodes & Physics
labels 2023-08-07 12:02:07 +02:00

Hi, thsnks for report. Can you check this in last 4.0 blender?

Hi, thsnks for report. Can you check this in last 4.0 blender?

The same appears to happen in 4.0.

I edited the description to make the issue clearer.

I believe what is happening is that, as the particle is reflected when "Is Hit", it is moved outside the hit threshold (25cm) and thus is no longer in the "Hit" condition.

This seems to be a kind of dependency cycle.
The Raycast node seems to be updated sometimes based on the initial position and sometimes based on the final position.

Looks like a bug to me.

The same appears to happen in 4.0. I edited the description to make the issue clearer. I believe what is happening is that, as the particle is reflected when "Is Hit", it is moved outside the hit threshold (25cm) and thus is no longer in the "Hit" condition. This seems to be a kind of dependency cycle. The `Raycast` node seems to be updated sometimes based on the initial position and sometimes based on the final position. Looks like a bug to me.

Here the viewer is showing the Ray direction input of the raycast node (CurrentVelocity), and the position of the point:

image

21: ray points down, doesn't hit within 0.25m.
22: ray points up, so it doesn't hit either.
74: only then, z < 0.25 and Vz < 0, so the ray hits. It is here also the first frame where "Hit normal" is not zero (I'm asuming that's the default, no-hit value).

So in a certain way, the Raycast node seems to be doing what it should, using always the position of the point at the current frame, before being modified by the Set Position node, which comes right after the Raycast node is used. But then, why is the point bouncing? Maybe some step is being processed that is not seen with this viewer setup. This is in version 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: c7fc78b81ecb.

Disconnecting the Hit Normal output from the Reflect node (leaving the default 0 0 0) changes the velocity in a way that makes the Raycast node do what I think the user wanted to, making the point teleport on each bounce. But of course this means it won't work with inclined surfaces. For collision detection, consider using the velocity length as a basis for the Ray Length input of the Raycast node.

Here the viewer is showing the Ray direction input of the raycast node (CurrentVelocity), and the position of the point: ![image](/attachments/3267f222-8a77-401f-b3d7-db392a697afa) 21: ray points down, doesn't hit within 0.25m. 22: ray points up, so it doesn't hit either. 74: only then, z < 0.25 and Vz < 0, so the ray hits. It is here also the first frame where "Hit normal" is not zero (I'm asuming that's the default, no-hit value). So in a certain way, the Raycast node seems to be doing what it should, using always the position of the point at the current frame, before being modified by the Set Position node, which comes right after the Raycast node is used. But then, why is the point bouncing? Maybe some step is being processed that is not seen with this viewer setup. This is in version 3.6.0, branch: blender-v3.6-release, commit date: 2023-06-27 08:08, hash: `c7fc78b81ecb`. Disconnecting the Hit Normal output from the Reflect node (leaving the default 0 0 0) changes the velocity in a way that makes the Raycast node do what I think the user wanted to, making the point teleport on each bounce. But of course this means it won't work with inclined surfaces. For collision detection, consider using the velocity length as a basis for the Ray Length input of the Raycast node.

Not a bug, but an error in the node tree. There are several of them:

  • In the first few bounces, the normal is reflected. Ray directed in the other direction. Caused by the second one.
  • You first update the position (Set Position) and then output the simulation velocity. But your speed is a field, and it will be evaluated for the new positions. Thus, you get the velocity 2 times, and it will be different, due to the existence of different positions.

It seems that what follows is no longer about bugs and can be considered expected behavior.
For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

Not a bug, but an error in the node tree. There are several of them: - In the first few bounces, the normal is reflected. Ray directed in the other direction. Caused by the second one. - You first update the position (Set Position) and then output the simulation velocity. But your speed is a field, and it will be evaluated for the new positions. Thus, you get the velocity 2 times, and it will be different, due to the existence of different positions. It seems that what follows is no longer about bugs and can be considered expected behavior. For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-08-08 01:48:45 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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
4 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#110867
No description provided.