Cycles: Deduplicate sphere intersection test #112031

Open
Alaska wants to merge 10 commits from Alaska/blender:cleanup-sphere-intersect into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Cleanup sphere intersection test by reusing the same code for point cloud intersection and sphere light intersection.

Cleanup sphere intersection test by reusing the same code for point cloud intersection and sphere light intersection.
Alaska added the
Module
Render & Cycles
label 2023-09-06 15:27:08 +02:00
Author
Member

Edit: This is irrelevant now.

As a side effect of this change (specifically using the better intersection from the point intersection test), The issues with sphere light rendering in #112005 is fixed.

Edit: This is irrelevant now. As a side effect of this change (specifically using the better intersection from the point intersection test), The issues with sphere light rendering in #112005 is fixed.
Alaska requested review from Weizhen Huang 2023-09-06 15:46:57 +02:00
Alaska requested review from Brecht Van Lommel 2023-09-06 15:47:08 +02:00
Alaska requested review from Sergey Sharybin 2023-09-06 15:47:17 +02:00
Alaska changed title from WIP: Cycles: Cleanup sphere intersection test to Cycles: Cleanup sphere intersection test 2023-09-06 15:48:17 +02:00
Member

Hi, I was about to push a fix to #112005

Hi, I was about to push a fix to #112005
Author
Member

Hi, I was about to push a fix to #112005

Feel free to use which ever method you want. This one or your own.

I probably should of noted I was working on this issue on the original report. Sorry about that.

> Hi, I was about to push a fix to #112005 Feel free to use which ever method you want. This one or your own. I probably should of noted I was working on this issue on the original report. Sorry about that.
Alaska changed title from Cycles: Cleanup sphere intersection test to WIP: Cycles: Cleanup sphere intersection test 2023-09-06 15:55:58 +02:00
Alaska changed title from WIP: Cycles: Cleanup sphere intersection test to Cycles: Cleanup sphere intersection test 2023-09-06 16:10:52 +02:00
Weizhen Huang requested changes 2023-09-06 16:49:30 +02:00
Weizhen Huang left a comment
Member

Hi, I committed the fix in fedeaab30f, thanks for investigating.
It appears that point_intersect_test() is using the same approach to compute l2 by subtracting first and then take the dot product. However, it adds quite some complexity that we don't need here. For example, the copysignf() in ray_sphere_intersect() means we always use t_front when we are outside of the sphere and the so-called t_back when we are inside the sphere, actually just the first intersection in both cases.
However, I'm not closing since this cleanup still makes sense to me, probably both can use ray_sphere_intersect() now, but not sure with the logic inside the sphere for the other case.

Hi, I committed the fix in fedeaab30f, thanks for investigating. It appears that `point_intersect_test()` is using the same approach to compute `l2` by subtracting first and then take the dot product. However, it adds quite some complexity that we don't need here. For example, the `copysignf()` in `ray_sphere_intersect()` means we always use `t_front` when we are outside of the sphere and the so-called `t_back` when we are inside the sphere, actually just the first intersection in both cases. However, I'm not closing since this cleanup still makes sense to me, probably both can use `ray_sphere_intersect()` now, but not sure with the logic inside the sphere for the other case.
Alaska force-pushed cleanup-sphere-intersect from 95133da96d to 319bf618f5 2023-09-07 02:27:11 +02:00 Compare
Author
Member

@weizhen I looked into transitioning the point intersection over to using ray_sphere_intersect(). But I encountered some issues, specifically issues with non-uniform points (E.G. A point with a scale of 1.0, 1.0, 0.5).

Since that resulted in the rendering of non-uniform points no longer matching Embree, I decided to just use a modified version of the intersection test for points instead. Quick tests reveal no noticeable issues with this approach.

@weizhen I looked into transitioning the point intersection over to using `ray_sphere_intersect()`. But I encountered some issues, specifically issues with non-uniform points (E.G. A point with a scale of 1.0, 1.0, 0.5). Since that resulted in the rendering of non-uniform points no longer matching Embree, I decided to just use a modified version of the intersection test for points instead. Quick tests reveal no noticeable issues with this approach.
Alaska requested review from Weizhen Huang 2023-09-07 02:30:02 +02:00
Alaska changed title from Cycles: Cleanup sphere intersection test to Cycles: Deduplicate sphere intersection test 2023-09-07 03:25:39 +02:00
Alaska added 1 commit 2023-09-07 06:17:43 +02:00
Alaska added 1 commit 2023-09-07 13:01:17 +02:00
Alaska added 1 commit 2023-09-07 13:21:19 +02:00
Alaska added 1 commit 2023-09-07 14:49:16 +02:00
Alaska added 1 commit 2023-09-07 15:13:56 +02:00
Alaska added 1 commit 2023-09-07 15:48:38 +02:00
Alaska added 1 commit 2023-09-09 03:42:36 +02:00
This pull request has changes conflicting with the target branch.
  • intern/cycles/kernel/light/point.h
  • intern/cycles/kernel/light/spot.h

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u cleanup-sphere-intersect:Alaska-cleanup-sphere-intersect
git checkout Alaska-cleanup-sphere-intersect
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
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
Asset Browser Project
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
2 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#112031
No description provided.