Bug? RenderTexture - SetProjectionMode

When I set texture projection mode for my texture:
SetProjectionMode(TextureProjectionMode.MappingChannel, ChangeContexts.Ignore);
SetMappingChannel(1, ChangeContexts.Ignore);

The result looks like if it was set to TextureProjectionMode.EnvironmentMap

And this one results in the correct mappingChannel mode
SetProjectionMode(TextureProjectionMode.View, ChangeContexts.Ignore);

Am I doing something wrong? (Or the enums are maybe mixed?)

Márton

@marton.parlagh I seem to be unable to reproduce with attached 3dm file TextureProjectionModeSettingTest.3dm (4.0 MB) and this code snippet:

import scriptcontext as sc
import Rhino as r

for rt in sc.doc.RenderTextures:
    rt.SetProjectionMode(r.Render.TextureProjectionMode.MappingChannel, r.Render.RenderContent.ChangeContexts.Program)
    rt.SetMappingChannel(1, r.Render.RenderContent.ChangeContexts.Program)

print "done"

The texture in the 3dm file gets properly its projection mode set.

after - mapping channel 1

If this is not the case then please share self-contained code example where the behavior is not correct.

Hello Nathan,

I have attached a sample codeTextureTest.cs (1.7 KB)

I don’t understand why it behaves like an environment mapping. (Probably I do something wrong.)

I add this texture to a simple box (via Custom material, diffuse channel)

and it looks wrong

Márton

Hello Nathan,

In case you have some time could you check my code please? Something is very unclear for me with texture projection settings it seems.

Márton

Ah sorry, I missed your replies. I’ll check your texture code.

Nathan, have you had time?

I was ill after that (shortness of breath and all that), so I haven’t looked yet. I mean, I briefly looked at it, but haven’t figured out yet what the cause is.

Ohhh, sorry for that - I hope you will be (or are) 100% healthy soon!

Thanks, I’m almost 100% again.

I’m currently compiling latest Rhino with your test texture integrated. Takes a while to complete though, but I’ll let you know what I find.

From a quick glance your code seems to be just fine, though, so will have to step into Rhino to see what is happening.

@marton.parlagh hey, I’m assigning this issue to @andy, so he can have a closer look at this.

Marton

I’m looking into this right now, and I’m down a very deep rabbit hole! I’ll let you know when I figure out what is going on.

It looks like a bug in Rhino at the moment.

  • Andy

Ok, thanks, let me know please:)

Márton

Yup - it’s a bug in Rhino. The best I’m going to be able to do is to fix it in a SR of Rhino 6 I’m afraid.

Thanks!
From which version number can I expect it?

Márton

Marton

I just committed the fix - it will be in 6.25. You will be able to get the first RC build of this next Wednesday, and the final release should be early May.

  • Andy

Thank you!

Márton