-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add base color texture node to tileset materials #406
Conversation
Should we create a temporary app that is derived from our test app that sets this to false while this is broken? It seems like it would make launching from our editors easier, but maybe it's overkill? |
It appears that if I try to switch between materials, or remove the material entirely, the tileset gets stuck with the first custom material I applied. It appears to only happen to the final level of detail that gets loaded, as the tile reloads you can see the new material coming in to the coarser detail levels, but it still ends up with the old material. Best shown in this capture. Screen.sharing.-.2023-08-02.10_02_15.AM.mp4 |
@r-veenstra I fixed the bug with switching materials. It was a bug in |
Or we could just disable fabric by default. Though that would mean having to click yes on the popup every time... |
I still need to fix the texture lookup functions to support y-up and z-up (probably via a uniform), and then this should be ready for review. Edit: I may tackle "Update materials in the pool when the main material changes" in a follow up PR |
I suspect this would break unit testing. |
A couple changes to the mdl. Existing
|
@weegeekps this is ready for review now. For testing you can check out the |
0f6dbca
to
993e8f2
Compare
I converted this to a draft. I'm experimenting with a way for tiles to share a single material, and depending on how that goes the approach here may change. |
6006330
to
d7fea97
Compare
2c20a58
to
1e9dd7e
Compare
This is ready for review again. The basic approach is still the same, but I changed what MDL functions are exposed.
Together you can create an MDL like this: |
1e9dd7e
to
7785d94
Compare
@corybarr you can ignore the sample data in the PR description. Some of those nodes have been removed temporarily, to be added back in a later PR. See the sample data in #406 (comment) instead. |
@@ -26,6 +27,7 @@ FabricMaterialDefinition::FabricMaterialDefinition( | |||
_hasVertexColors = materialInfo.hasVertexColors; | |||
_hasBaseColorTexture = hasBaseColorTexture; | |||
_imageryLayerCount = imageryLayerCount; | |||
_tilesetMaterialPath = tilesetMaterialPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit, but I'd probably do this and the above line as an initializer list. Any thoughts on what to do for consistency or other reasons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 67024a8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, OV MDL isn't an area I've spent a lot of time in. Duplicating and reconnecting is an interesting solution. Code makes sense and LGTM.
Follow up to #394 and builds upon #391
Adds a new MDL node
cesium_base_color_texture
that retrieves the base color texture of the tile. This can be used to create more complex materials than before like clipping out regions of a tileset. Here Cesium World Terrain is being clipped by the Cesium logo with clamp-to-edge sampling.tileset-materials-complex.zip
(Make sure to set
app.useFabricSceneDelegate = false
and enable fabric when the popup appears, otherwise it may not recognize the custom material. This is a known issue with USD material population in Fabric.)How it works:
If a material doesn't have any
cesium_base_color_texture
nodes it works the same as before: the Fabric prims reference the existing material and that's it.If a material has
cesium_base_color_texture
nodes we duplicate all the prims in the material network, reconnect the prims, and add a prim to read from the base color texture. Since materials can't reference texture paths via primvars we can't share the material like before, and instead need to duplicate the material X number of times depending on the size of the material pool. This also means you can't tweak materials dynamically unless you're able to watch for changes and update all materials in the pool.Future work:
cesium_base_color_texture
inputscesium_base_color_factor
,cesium_base_color_texture_alpha
,cesium_emissive_factor
, etc. We can expose whatever material values we want, I just didn't want to clutter this PR.