mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
723 stars 213 forks source link

How do we actually use HeightModifier and TextureSideWallModifier? #1369

Closed colin-young closed 5 years ago

colin-young commented 5 years ago

I'd like to try out the features provided by TextureSideWallModifier, but I have no idea how to even start with it. I understand I need to select "Custom" for the primitive under the modeling section, but then what? Do I need to add it to the mesh modifiers? How do I wire up the atlas to it?

So far I've only managed to generate a NullReferenceException on initialize.

Thanks for any pointers.

brnkhy commented 5 years ago

@colin-young unfortunately there's a bug with the inspector code at the moment making it hard to work with them using custom styling, but actually you dont need to. When you select polygon and realistic style for example, system will automatically use TextureSideWallModifier. Or if you choose custom in style type, you'll get a field for AtlasInfo, TextureSideWallModifier is based upon.

Our plan is to merge those two classes and fix the inspector issue as soon as possible though.

colin-young commented 5 years ago

Thanks! With that and https://github.com/mapbox/mapbox-unity-sdk/issues/486 I was able to figure it out.

colin-young commented 5 years ago

Slight issue -- I've taken an atlas of 4X2 and defined 7 slots. I've left the lower right (which should have been slot 8, index 7) out. It is a default UV rainbow texture. Element 6 is defined as 0.5, 0.5 with width 0.25 and height 0.5. Element 7 would have been 0.75, 0.5 and 0.25W x 0.5H. I'm still getting the UV texture showing up on some buildings.

Any ideas?

brnkhy commented 5 years ago

@colin-young It's really hard to understand like that I'm afraid. Can you post a screenshot? Atlas styles randomly select one of the grids defined in them. That might be the confusion maybe? I believe your 6th and 7th elements are top right quarter of the sheet. But first 5 elements are probably showing other three quarters of the sheet? (bottom left, bottom right, top left)

colin-young commented 5 years ago

Ha ha. I think I got my coordinates mixed up. 0,0 is the bottom left, correct? So 0.75, 0.5 would be top right corner? I did it the other way around... assuming 0,0 was top left with y value increasing down. Oops. I understand the random selection bit, but didn't notice that one of my legitimate styles was missing.

Expected:   Actual:
|1|2|3|4|   |5|6|7|X|
|5|6|7|X|   |1|2|3|4|

I wonder if the new UIElements would make it easier to create a GUI for editing the atlas. I haven't played with it yet, but it sounds (and based on my experience with CSS flexbox) like it might be a really natural fit. I might have to play around with it a little bit to see.

UPDATE: Yup. Mixed up the origin/positive x direction.