UsdPreviewSurface does not respect normals texture bias and scale #106326

Closed
opened 2023-03-30 18:36:35 +02:00 by Eric-Haines · 3 comments

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

Blender Version
Broken: version: 3.6.0 Alpha, branch: cycles-light-linking, commit date: 2023-03-30 09:25, hash: 741a5bc734d2
Worked: (newest version of Blender that worked as expected)

Short description of error
The UsdPreviewSurface material includes a bias and scale value to modify normal textures. Blender's USD importer does not interpret these input values, leading to rendering errors.

Exact steps for others to reproduce the error
I have put the Blender files needed as attached files. I will also explain below how to load the NormalsTextureBiasAndScale.usda in Blender and set up the test conditions, in case there is a problem with my .blend save file.

The normal texture bias and scale values and their importance is explained in depth on the USD Assets repository site on this page.

Short version: load normal_bias_and_scale.blend and compare results - see end of this report. The images differ because normal texture map bias and scale are not interpreted by the USD importer.

Long version, importing the original USD test file: Download the NormalsTextureBiasAndScale.usda model and PNG textures attached below, or there.
Start Blender.
Delete the default Cube and Light objects.
Import NormalsTextureBiasAndScale.usda into Blender: File -> Import -> USD
Select Camera.001 and make it active (select it, then in upper left: View -> Cameras -> Set Active Object as Camera).
Select Viewport Shading (icon in upper right of viewport). Eevee renderer is assumed.
Open the NormalsTextureBiasAndScale model in the Scene Collection (upper right of screen).
Select the AngledLight.
In the lower right, pick the Object Data Properties and change the Strength from 50000 to 4.8, which will match the repo's image fairly well. (It being 50000 by default is a separate bug.)

In Blender three "R" bump maps appear on each cube:

AngledLight adjusted view

(Attached, also at https://i.postimg.cc/j2cgh6n9/blender-normals.jpg)

These "R" images should all look about the same along the three tops. They do not in Blender, but do in usdview, for example. Here's the usdview render, from the repo page:

USD Assets view

Similarly, the three left sides should be about the same, and three right sides should be about the same.

The problem is simply missing functionality: the normals scale and bias values in UsdPreviewSurface are not interpreted. These are important to interpret properly, as DirectX and OpenGL typically expect different types of normal maps, for example.

**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.02 **Blender Version** Broken: version: 3.6.0 Alpha, branch: cycles-light-linking, commit date: 2023-03-30 09:25, hash: `741a5bc734d2` Worked: (newest version of Blender that worked as expected) **Short description of error** The UsdPreviewSurface material includes a bias and scale value to modify normal textures. Blender's USD importer does not interpret these input values, leading to rendering errors. **Exact steps for others to reproduce the error** I have put the Blender files needed as attached files. I will also explain below how to load the NormalsTextureBiasAndScale.usda in Blender and set up the test conditions, in case there is a problem with my .blend save file. The normal texture bias and scale values and their importance is explained in depth on the [USD Assets repository site on this page](https://github.com/usd-wg/assets/tree/main/test_assets/NormalsTextureBiasAndScale). Short version: load normal_bias_and_scale.blend and compare results - see end of this report. The images differ because normal texture map bias and scale are not interpreted by the USD importer. Long version, importing the original USD test file: Download the NormalsTextureBiasAndScale.usda model and PNG textures attached below, or [there](https://github.com/usd-wg/assets/tree/main/test_assets/NormalsTextureBiasAndScale). Start Blender. Delete the default Cube and Light objects. Import NormalsTextureBiasAndScale.usda into Blender: File -> Import -> USD Select Camera.001 and make it active (select it, then in upper left: View -> Cameras -> Set Active Object as Camera). Select Viewport Shading (icon in upper right of viewport). Eevee renderer is assumed. Open the NormalsTextureBiasAndScale model in the Scene Collection (upper right of screen). Select the AngledLight. In the lower right, pick the Object Data Properties and change the Strength from 50000 to 4.8, which will match the repo's image fairly well. (It being 50000 by default is a separate bug.) In Blender three "R" bump maps appear on each cube: ![AngledLight adjusted view](https://erich.realtimerendering.com/download/blender/blender_normals.jpg) (Attached, also at https://i.postimg.cc/j2cgh6n9/blender-normals.jpg) These "R" images should all look about the same along the three tops. They do not in Blender, but do in usdview, for example. Here's the usdview render, from the repo page: ![USD Assets view](https://github.com/usd-wg/assets/raw/main/test_assets/NormalsTextureBiasAndScale/screenshots/crn_usdview.png) Similarly, the three left sides should be about the same, and three right sides should be about the same. The problem is simply missing functionality: the normals scale and bias values in UsdPreviewSurface are not interpreted. These are important to interpret properly, as DirectX and OpenGL typically expect different types of normal maps, for example.
Eric-Haines added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-30 18:36:36 +02:00
Member

Hi, thanks for the report. I can confirm the difference in textures of each cube.
If I understand correctly, bias and scale are used to match the "Normal texture" range [-1, 1].
Maybe issue is that the "scale" and "bias" attributes are not found during the import and their default values are used i.e. float4 2.0 and float4 -1.0 resp.
My findings might be wrong.
cc @makowalski

Hi, thanks for the report. I can confirm the difference in textures of each cube. If I understand correctly, bias and scale are used to match the "Normal texture" range [-1, 1]. Maybe issue is that the "scale" and "bias" attributes are not found during the import and their default values are used i.e. float4 2.0 and float4 -1.0 resp. My findings might be wrong. cc @makowalski

The USD importer currently doesn't handle "scale" and "bias", but this should definitely be supported. I'm planning to address several USD Preview Surface import/export issues for Blender 3.6, and I'll add this task to the list. Thank you for the helpful test data, @Eric-Haines!

The USD importer currently doesn't handle "scale" and "bias", but this should definitely be supported. I'm planning to address several USD Preview Surface import/export issues for Blender 3.6, and I'll add this task to the list. Thank you for the helpful test data, @Eric-Haines!
Author

One other unrelated bug that this USD file shows is for light import. There are four lights in the USD file, three of them are:

token visibility = "invisible"

I would have expected all four lights to be imported, not just the visible one. The three "invisible" lights would come in with their visibility off.

One other unrelated bug that this USD file shows is for light import. There are four lights in the USD file, three of them are: token visibility = "invisible" I would have expected all four lights to be imported, not just the visible one. The three "invisible" lights would come in with their visibility off.
Blender Bot added
Status
Resolved
and removed
Status
Needs Info from Developers
labels 2024-02-02 23:23:40 +01:00
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
3 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#106326
No description provided.