Cycles: difference in texture position between OpenGL and Cycles render (CPU and OpenCL) #50238

Closed
opened 2016-12-13 13:15:08 +01:00 by matali23 · 15 comments

System Information
all vendors

Blender Version
Broken: 2bb7a13

Short description of error
Texture position is different in viewport material viewmode and rendered viewport

Exact steps for others to reproduce the error
Open attached blend bug tex proj geom opencl openGL v2.blend, hit shift+Z in viewport to start border rendering. You get a visible position difference:

diff openGL OpenCL.PNG

**System Information** all vendors **Blender Version** Broken: 2bb7a13 **Short description of error** Texture position is different in viewport material viewmode and rendered viewport **Exact steps for others to reproduce the error** Open attached blend [bug tex proj geom opencl openGL v2.blend](https://archive.blender.org/developer/F417396/bug_tex_proj_geom_opencl_openGL_v2.blend), hit shift+Z in viewport to start border rendering. You get a visible position difference: ![diff openGL OpenCL.PNG](https://archive.blender.org/developer/F417395/diff_openGL_OpenCL.PNG)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @matali23

Added subscriber: @matali23
Added subscribers: @LukasStockner, @MartijnBerger, @Sergey, @ThomasDinges, @mont29

Can confirm, probably some OGL code not inline with actual render? @Sergey, @ThomasDinges, @LukasStockner, @MartijnBerger or any other #Cycles dev interested? ;)

Can confirm, probably some OGL code not inline with actual render? @Sergey, @ThomasDinges, @LukasStockner, @MartijnBerger or any other #Cycles dev interested? ;)

Added subscriber: @bliblubli

Added subscriber: @bliblubli

Can also confirm. I encountered the same bug today. After double checking, the OGL size and/or position is wrong, the cycles size and/or position is right.

Can also confirm. I encountered the same bug today. After double checking, the OGL size and/or position is wrong, the cycles size and/or position is right.

it's the math divide node that trigger the bug: bug glsl position tex1.blend

it's the math divide node that trigger the bug: [bug glsl position tex1.blend](https://archive.blender.org/developer/F520701/bug_glsl_position_tex1.blend)

Interesting!

If i re-type that 0.008 then the issue goes away. How did you put value to the node?

Interesting! If i re-type that 0.008 then the issue goes away. How did you put value to the node?

Added subscriber: @fclem

Added subscriber: @fclem

Here is a simpler file.
bug tex proj geom opencl openGL v2 (1).blend
Increase the rotation Z value with shift click and you will see it only updates after a view click. In render mode it updated right away.
This is a precision issue.
The object is far from the rotation origin and the value on which you apply the rotation is very high / low.
I guess OGL has less float precision when dealling with this. It seems that all transformation are baked into a single matrix on the GLSL end. I do not know about cycles.

Here is a simpler file. [bug tex proj geom opencl openGL v2 (1).blend](https://archive.blender.org/developer/F520706/bug_tex_proj_geom_opencl_openGL_v2__1_.blend) Increase the rotation Z value with shift click and you will see it only updates after a view click. In render mode it updated right away. This is a precision issue. The object is far from the rotation origin and the value on which you apply the rotation is very high / low. I guess OGL has less float precision when dealling with this. It seems that all transformation are baked into a single matrix on the GLSL end. I do not know about cycles.

Mapping node is converted to mat4 on CPU side for both GLSL and Cycles. Shading system will perform point*matrix multiplication when evaluating shader.

There might be some precision loss there because we use different code on Blender and Cycles side to construct matrix (aka, we don't access matrix from Cycles via API but recontruct it).

Mapping node is converted to mat4 on CPU side for both GLSL and Cycles. Shading system will perform point*matrix multiplication when evaluating shader. There might be some precision loss there because we use different code on Blender and Cycles side to construct matrix (aka, we don't access matrix from Cycles via API but recontruct it).

In #50238#424557, @Sergey wrote:
Interesting!

If i re-type that 0.008 then the issue goes away. How did you put value to the node?

Same here, retyping the value removes the bug :D I copy pasted it from the original attached file I think.

@fclem Not sure, but if it was a precision issue, retyping it wouldn't solve the bug?

> In #50238#424557, @Sergey wrote: > Interesting! > > If i re-type that 0.008 then the issue goes away. How did you put value to the node? Same here, retyping the value removes the bug :D I copy pasted it from the original attached file I think. @fclem Not sure, but if it was a precision issue, retyping it wouldn't solve the bug?

Ok, another precision. Python doesn't suffer from this problem. So replacing the divide node at 0.0084667 with a multiply node at 1/0.0084667 workaround the bug. But it's really cumbersome. This view is at 39 unit from origin. I wouldn't call that far away, so precision shouldn't be an issue. Maybe constant folding could do this job and change the divide node to a multiply node? Or just rearrange computation to maximize precision?

Ok, another precision. Python doesn't suffer from this problem. So replacing the divide node at 0.0084667 with a multiply node at 1/0.0084667 workaround the bug. But it's really cumbersome. This view is at 39 unit from origin. I wouldn't call that far away, so precision shouldn't be an issue. Maybe constant folding could do this job and change the divide node to a multiply node? Or just rearrange computation to maximize precision?

This issue was referenced by 467d824f80

This issue was referenced by 467d824f805ab88bad63a6cef3e57113ba5a3b2b

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' 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
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
6 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#50238
No description provided.