Grasshopper Texture Mapping Issues

Seeing that the latest Rhino 9 WIP added texture mapping components, I immediately rushed to test them. I noticed that box mapping works strangely, it does not give the expected results. It looks like a bug, because when entering the same data regarding box mapping rotation in Rhino UI, everything seems to work as it should.

PS.
Thanks a lot for these components!

System Info

Rhino 9 SR0 2025-2-4 (Rhino WIP, 9.0.25035.12305, Git hash:master @ 2ef72747dbd0ece04edffba24dee60582c380bfc)
License type: Educational, build 2025-02-04
License details: Cloud Zoo
Expires on: 2025-03-21

Windows 11 (10.0.26100 SR0.0) or greater (Physical RAM: 64GB)
.NET 7.0.11

Computer platform: LAPTOP - Plugged in [100% battery remaining]

Non-hybrid graphics configuration.
Primary display and OpenGL: NVIDIA RTX A3000 12GB Laptop GPU (NVidia) Memory: 11GB, Driver date: 12-11-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 553.50
> Integrated accelerated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port
Primary OpenGL: NVIDIA RTX A3000 12GB Laptop GPU (NVidia) Memory: 11GB, Driver date: 12-11-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 553.50
> Integrated accelerated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port

Secondary graphics devices.
Intel(R) UHD Graphics (Intel) Memory: 2GB, Driver date: 8-19-2024 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- Secondary monitor is laptop’s integrated screen or built-in port

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
GPU Tessellation is: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 12-11-2024
Driver Version: 31.0.15.5350
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 11520 MB

Rhino plugins that do not ship with Rhino
C:\ProgramData\McNeel\Rhinoceros\7.0\Plug-ins\Datasmith Rhino Exporter (d1fdc795-b334-4933-b680-088119cdc6bb)\DatasmithRhino7.rhp “Datasmith Exporter” 5.5.1.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\9.0\Plug-ins\Bella (813de3fb-18eb-405f-bfcd-b0b4d3da91fb)\24.6.2.0\bella_rhino.rhp “Bella” 24.6.2.0
C:\Users\Czaja\AppData\Roaming\McNeel\Rhinoceros\9.0\Plug-ins\Crayon (39629248-4fa6-47b8-83c7-745a7efea259)\1.2.0.0\Crayon\Crayon.rhp “Crayon” 1.0.0.0
C:\Program Files\Rhino 9 WIP\Plug-ins\ConstraintsUI.rhp “Constraints UI” 9.0.25035.12305

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 9 WIP\Plug-ins\Commands.rhp “Commands” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 9 WIP\Plug-ins\MeshCommands.rhp “MeshCommands” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCycles.rhp “RhinoCycles” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 9.0.25035.12305
C:\Program Files\Rhino 9 WIP\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 9 WIP\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 9 WIP\Plug-ins\SectionTools.rhp “SectionTools”

GH Texture Mapping Test 2.3dm (287.7 KB)
GH Texture Mapping TEST 2.gh (12.2 KB)

Box Mapping edited in Rhino UI (expected results)

Box Mapping straight out of Grasshopper

Rhino 9.0.25043.12305

Two issues.

  1. Texture mapping is not written to the Model Object with the first push action. It’s showing surface mapping instead of spherical mapping, I need to push Model Object once again to fix that.
  2. Texture mapping is not assigned to the Model Object inside the Block Definition.

Thanks for chiming in, since it’s a WIP and not an internal build I wanted to experiment with some workflows and detect some issues as early as possible.
In the past, I was using your GH components for texture mappings, but I am counting on these because they will fit nicely with the Content Cache.

@Czaja I have created RH-86063 and RH-86064 to track the two bugs that you reported.

This is how the a box mapping looks (in Rhino) when I use the same red box as the “box” used to define the box mapping on both of the other two cubes. Here, I selected each box, then applied the Box Mapping to it. When prompted, I used the red box to define the boundary of the box that I wanted to use.

I can then create a GH Definition that essentially performs this same action. I reference in the red box and use that to define the box that I want to use in the box mapping. I then apply that box mapping to the other two cubes and push it to the document. The result looks like this.

You can see from both images that the mappings are the same. I can’t exactly tell what’s happening in your video and I know you’re using a C# component… but I believe this is working the way it is expected to. If I am mistaken, please let me know with some further details. Thanks.

BoxMappingDemo.gh (11.8 KB)
BoxMappingDemo.3dm (331.0 KB)

Texture mapping, the way it is implemented… is complex. However, the normal transform that is shown as a property of the Texture Mapping class is not really used (and neither is the “Primative Transform” since this is misspelled and made obsolete by the other “Primitive Transform”).

Basically the way it breaks down is that there are two transforms that you have to keep track of. One is the local transform of the object that has the texture mapping applied to it. The other is the Primitive Transform of the mapping object. These two transforms get combined in a specific way to determine how the texture should look on the objects.

But, as I said, the Normal Transform is not really used at all in any of the calculations.

It’s just a rotated minimum bounding box component made by @RIL ( Minimum oriented bounding box. Implementation in Grasshopper + Python script node - #61 by RIL ). Each cube is referencing an oriented minimum bounding box so the box mapping is almost identical to the geometry that is being textured. In this case I would expect to receive perfect grid since Geometry (cube) = Box Mapping Widget.

But to make things even simpler we can remove the minimum bounding box component completely and directly cast Model Objects to Box and use it in the Box Texture Mapping component. As you can see, one of the boxes have two faces showing stretched lines instead of grid.
In my previous post I didn’t graft one input, but it didn’t make a difference. Here are updated files:

GH Texture Mapping TEST 3.gh (11.1 KB)
GH Texture Mapping Test 3.3dm (230.9 KB)

Clue of the video is that after the Grasshopper solution, two sides of one Model Object are stretched (and they shouldn’t be), the slightless change in the Rhino UI fixes this problem. So it looks like something is off when pushing the texture mapping through Grasshopper.

Apologies. I’m not very well informed on texture mappings. :wink:

I believe in the OP’s example, two objects (one handmade, one pushed from GH) have same parameters in the Rhino mapping panel but have different looks, which confuses OP.

This is strange. I was able to replicate the issue you showed in the video with that one cube on the right. I edited some stuff in the code, but then deleted it and went back to the original code base. When I ran the example again, everything worked. I even tested this on debug and release builds and I can’t seem to replicate the issue anymore. A telling issue for me was that it seemed to work fine on the other cubes, but it was only that one cube on the right that seemed to be off… The underlying code should be the same for all 3 cubes, so this seemed off for me.

Perhaps try downloading the next release of the 9.0 WIP and test it out (it should be released tomorrow afternoon).

Unfortunately, it’s still acting up.

Attaching minimal test file. The same box, but only plane is flipped.

wrong


correct

GH Texture Mapping - minimal test.3dm (317.9 KB)

GH Texture Mapping Issue - minimal test v2.gh (11.2 KB)

Hmm… Ok. I’ll have to keep looking into this.