Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Map doesnt look exactly like Style on Website #1400

Open
peachpieproductions opened this issue Jun 17, 2019 · 10 comments
Open

Unity Map doesnt look exactly like Style on Website #1400

peachpieproductions opened this issue Jun 17, 2019 · 10 comments

Comments

@peachpieproductions
Copy link

When I fill out the MapId / Style URL with my style URL in Unity it does not render extruded buildings like it does on the website style editor. I can add "buildings" to "FEATURES" and it renders building, but they dont use the settings I have set up on the mapbox website. I am setting a min height to all building to make sure the ones without height data still look at least 2 stories high. I cant adjust the min height in Unity. Is there a way to have it look exactly like it does on the mapbox style page? Also the ground is supposed to be alpha, but is just black in Unity.

On Mapbox Website (style editor):
image

In Unity:
image

Note: If this is a bug or support ticket, please provide the following information:

  • Unity version: 2018.4.2f1
    • Scripting Runtime Version: .NET 4.x Equivalent
    • Scripting Backend: Mono
    • Api Compatibility Level: .NET Standard 2.0
  • Mapbox SDK version: 2.0
  • The platform you're building to: Android
  • A description of what you're trying to do: See map the same way in Unity as in Mapbox Style Editor.
  • Steps to recreate the bug if appropriate:
  • Links to your logs are also helpful:
@brnkhy
Copy link
Contributor

brnkhy commented Jun 18, 2019

@peachpieproductions
MapId/Style Url fields are used for data optimization, not for cloning/using same style, sorry for the confusion. So this is expected.
There isn't an option to change minimum height in unity but I believe it was set to 3 meters by default, I might be wrong on that though. To be able to customize it you'll have to edit some code manually. I would suggest checking height field in TexturedSideWallModifier.
And as you said, alpha doesn't work in unity right away as we're not using a transparent shader by default. I cannot remember for sure at the moment but I think our raster services doesn't use alpha either and you would have to filter transparent places by color (bright green etc) using a custom shader. I think there's a shader for this already called Raster with transparency but I haven't used it for a loong time so not sure if it's working at the moment (might not be upgraded for newer versions). Still might give you an idea. Hope that helps!

@peachpieproductions
Copy link
Author

@brnkhy
Thank you so much for the response! Very helpful. I was able to get the alpha working by switching the mode of the shader to "Cutout".

As for the TexturedSideWallModifier, Do I add that to the Abstract map?

@brnkhy
Copy link
Contributor

brnkhy commented Jun 19, 2019

@peachpieproductions TexturedSideWallModifier is added and used by default so any code change will directly reflect on your output. Of course changing sdk code isn't the most elegant solution but at least to test it out, will be the fastest.
At the moment line 130 looks like;
height = (maxHeight - minHeight);
and to test you can try changing it like;
height = Mathf.Max(3, (maxHeight - minHeight));

@peachpieproductions
Copy link
Author

@brnkhy
Thank you for the quick feedback!
When I edit that line of code, it is never called when I run in the editor. I am using the AR worldscale manual calibration demo scene. Does the building texture style matter? Mine is set to "Custom".
I am calling "Debug.Log(height);" right after line 130 and nothing ever get written to the log.
I must be missing something obvious. Thank you so much for your help thus far!

@peachpieproductions
Copy link
Author

@brnkhy
Okay so I found that under "Behavior Modifiers" I was able to add TextureSideWallModifier.
Although now when I run the scene in the editor I get this error -

"NullReferenceException: Object reference not set to an instance of an object
Mapbox.Unity.MeshGeneration.Modifiers.TextureSideWallModifier.Initialize () (at Assets/Mapbox/Unity/MeshGeneration/Modifiers/TextureSideWallModifier.cs:90)"

@brnkhy
Copy link
Contributor

brnkhy commented Jun 20, 2019

@peachpieproductions If you select Polygon instead of Custom, it should work. Custom means you'll add all modifiers yourself but I'm afraid it's (especially that height modifier part) is a little buggy at the moment. Can you try Polygon and let me know again?

@peachpieproductions
Copy link
Author

@brnkhy Hey there! Thank you for the prompt response! I actually meant that "Style Type" under "Texturing" tab is set to Custom. Under "Modeling" tab the "Primitive Type" is set to "Polygon" and I am getting the error still. Here are my settings -
image

@brnkhy
Copy link
Contributor

brnkhy commented Jun 24, 2019

@peachpieproductions since you already selected polygon, that modifier is added by default and then you add it once more by hand under the mesh modifiers list so system trying to run it twice. If you changed the code inside texturesidewallmodifier, you can just remove the one under mesh modifier in the screenshot and it should work.

@peachpieproductions
Copy link
Author

@brnkhy
Even set to Polygon, and without a behavior modifier, the code at line ~130 is never called. I have placed a Debug.Log() there that never gets called. It is under the Function "Run".

image

image

@brnkhy
Copy link
Contributor

brnkhy commented Jun 26, 2019

@peachpieproductions oh my bad, I'm sorry. I think it uses the old regular height modifier when Tiled is selected as Texturing Type.
If you want to use Tiled texturing, you should look for same line in Height Modifier class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants