Rhino3dm.js Texture Repeating

Following discussion with @will I think this is a query for @fraguada.

I was testing importing some geometry into three.js that has materials with textures imported from the Material Library in Rhino. Some of these textures include “repeat” values that change the scale of the texture on the rhino object. This isn’t copied across to the three.js loaded geometry where the texture appears to be scaled with value 1.0 only. I thought perhaps I could extend the loader to allow this but I cannot find the information regarding texture repeating when using rhino3dm.js. Any hints or tips gratefully received.

hi Luis @fraguada, supporting texture tiling would be super useful for us as well. Three.js does support texture tiling.

I also noticed a couple of other important limitations with the .3dm loader for three.js:

  • Any PBR materials applied in Rhino are being ignored
  • Should the loaders change the rhnio file from Z up to Y up? otherwise, all models show up rotated -90 degrees on X.



1 Like

@gustojunk @jjs can you provide any simple files that don’t work as expected? I’ll take a look at this in the next week.

1 Like

hi @fraguada see images and file attached. Texture is set with repeat of 2 but this doesn’t end up in the Three.JS scene. It seems the loader currently just sets texture repeat to 1, regardless of what existed in the 3dm file.

model.3dm (1.5 MB)

1 Like

Thank you. I’ll take a look.

@jjs just took a look and we haven’t added the bindings to this to the js or py library. I’ll work on that and let you know when you can check it out.

I think I have it, but there is an issue with extrusions (particular to this case):

Notice the mapping on the right face.

If I first explode the extrusion and join as a brep (in Rhino), the mapping results in threejs are (more) correct:

While we do have a method to convert an Extrusion to a Brep in rhino3dm, it looses any associated render mesh in the process, so the brep won’t be visible. So unfortunately the best method for getting extrusions to have the correct texture repeating (at this time) is to explode in Rhino first :frowning:

To be honest if the mapping works provided things are exploded or made into breps I think that’s fine! Thanks a lot!

1 Like

I am going to push this to our repository and make a PR to the three.js repo, but there are several moving parts. First, the rhino3dm.js library with these changes needs to be published, then we need to update the 3dmLoader in threejs. I’ll keep you updated on the process.

1 Like

The library has been updated and a PR has been submitted to three.js. The threejs 135 release should go out November 24th.

1 Like

PR has been merged. You can test this now in a live version of the r135dev editor: three.js editor

1 Like

I will start looking at PBR next. I am not sure how much of this stuff is exposed in openNURBS.

This looks really terrible, but I am able to bring a lot of the PBR material data since a good deal of it is already exposed in rhino3dm.

I need to rewrite the material processing part of the 3dmLoader to handle all of the textures a bit more elegantly. Basic properties work fine:

Will continue this next week.

Attenuation distance and color? Is that subsurface related stuff?

Dunno, we’ll need to study if and how stuff translates…