Jump to content

Editor workflow discussion


Josh
 Share

Recommended Posts

Something I started doing in the code is using strings for properties like this:

	void ModelEditor::ApplyProperties(shared_ptr<Material> material)
	{
		materialproperties->SetText("Material", "Name", material->name);
		materialproperties->SetValue("Material", "Metalness", material->GetMetalness());
		materialproperties->SetValue("Material", "Roughness", material->GetRoughness());
		materialproperties->SetState("Material", "Tessellation", material->GetTessellation());
		materialproperties->SetValue("Material", "Color", material->GetColor());
		materialproperties->SetValue("Material", "Emission", material->GetEmission());
		materialproperties->SetState("Material", "Alpha mask", material->GetAlphaMask());
		materialproperties->SetState("Material", "Transparent", material->GetTransparent());
		materialproperties->SetState("Material", "Shadows", material->GetShadow());
		materialproperties->SetState("Material", "Two-sided", not material->GetBackFaceCullMode());
		materialproperties->SetValue("Material", "Displacement", material->GetDisplacement().x);
		materialproperties->SetValue("Material", "Offset", material->GetDisplacement().y);
	}

Instead of declaring a million widget variables I just set values and detect events based on the property name. This cuts the size of the code down by a lot, probably 4x less code. It's very easy to add new properties without modifying any headers.

I want user-made extensions to be able to add their own properties and store them in glTF and scene files. My main focus for extensions is editing and storing custom data, and creating custom tools. Not so much concerned with the user's ability to drastically modify the existing features or program layout.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Ultra workflow is made with great love for you. Using a combobox works really well for the textures, because you can select an embedded texture, browse for a new texture, go to the existing texture, or remove it, without adding a lot of buttons that wouldn't fit.

image.thumb.jpeg.9ec57a9e50f1dcc443baf92358be44f2.jpeg

  • Like 3

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

In practice you don't really want to use .glb with embedded textures because you will want to convert your textures to DDS or Basis. When you save as glTF (text file with an accompanying binary file) you can then publish your game with just the optimized textures and leave the PNG files out of your game.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Extending the combobox usage to add a field for the mesh material works out better. You can jump to the material, select a new one, remove it, and browse for a file, within a very simple interface.

image.thumb.jpeg.79f7df9619c5499d1a919b5402acc4ee.jpeg

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

16 hours ago, reepblue said:

Maybe there should be something upfront informing the user if the model is using an optimized texture or if the gltf is still using the image.

I added a field that lists all the texture file formats used so you can tell at a glance whether the glTF is optimized or not.

image.thumb.png.bec903ca40ca86e42436adce6c230831.png

  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Hey, would it be possible for a gltf to support multiple diffuse textures or multiple sets without copying the model? Like you have a barrel model but you have a texture where it's blue but another one that's red with a fire icon on it  It would be nice to have one model with all the variations. 

Another example: Portal 2 has multiple skins for it's weighted storage cube. There's a clean skin, clean activated, dirty, dirty activated, etc. Having this support would also make it easier to change emission colors without a shader edit like I had to do in Cyclone. Since shaders are more complicated in Ultra, I would like to just change one or more texture sheets for that instance of the model.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Understandable, but that would be wonderful if that gets added. I really don't want to touch Vulkan shaders for simple effects.

Speaking of which, do you still have texture scrolling and rotation in the shader? Options for that should be in the material editor too.

If I were to make Cyclone on Ultra, I would need material variants and texture scrolling and rotation. The cyclones themselves are tricky because I rotate 2 sheets at a different rate so that would need a custom shader unless I were to animate them in the DDS texture. This is how Valve did their portals before adopting the current look as each texture was 200mb animating at 30 fps, and it needed to run on the Xbox 360. If I were to animate my cyclones, I probably would try to compress it to basis, or simply not worry about it. 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Here's a 3D texture in the editor. You can scroll through the layers and view each slice, so 3D textures aren't (figuratively) opaque any more they used to be. There is some per-object scrolling stuff in there, which could handle both animation and skin switching. However, I might have had to make room to fit a lightmap index in...I will need to revisit this and see what can be done.

image.thumb.jpeg.d5b99292e43efed388a5da552307b578.jpeg

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Actually using a 3D texture would be a really bad idea because the mipmaps gets blended together on the Z axis as well, so the separate skin mipmaps would start to bleed into each other...scratch that.

  • Sad 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

It looks like the material variant feature is supported in the official Blender exporter.
https://docs.blender.org/manual/en/3.4/addons/import_export/scene_gltf2.html#gltf-variants

You might want to look into that and see how it works.

And here is a sample model using the feature:
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MaterialsVariantsShoe

It looks like this is the right way to go.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Why in the world did they design it like this?:

          "KHR_materials_variants" : {
            "mappings": [
              {
                "material": 2,
                "variants": [0, 3],
              },
              {
                "material": 4,
                "variants": [1],
              },
              {
                "material": 5,
                "variants": [2],
              },
            ],

When what they really meant was this:

          "KHR_materials_variants" : {
            "mappings": [2, 4, 5, 2]
          },

 

  • Confused 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

 

A new build of the editor is up. I called this "UltraEngine_c.exe" so you can still compare it with the earlier versions.

Selection highlight is not working yet. I need to work this out carefully. You can ignore any error about an outline post-effect failing to load.

This build makes a big improvement to the asset workflow.

  • Each asset opens in a new window
  • All embedded assets are viewed and edited within the window of the model they are stored in
  • You can click in the 3D viewport to select meshes
  • The Mesh > Material and Material > Textures properties now contain a lot of options packed into the combo boxes
  • You can jump to a material or texture with the "Edit..." option in the comboboxes
  • 3D navigation is much smoother now. Left click selects, right click rotates the camera, middle mouse button pans
  • No pan or zoom right now when viewing textures because that's not what I am focusing on

I recommend opening some glTF, OBJ, and Leadwerks MDL files to see how it works. Also try out some .glb files, as these are the only files that support embedded textures:
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Lantern/glTF-Binary
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet/glTF-Binary

Please try it and let me know what you think of the design and workflow.

 

  • Like 3

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'm working out a better approach to the selection highlight. This shows the edge outline on top of other objects, while the original object stays underneath in the correct Z-order. I think they did this in Left 4 Dead to show your teammate's outline through walls.

image.thumb.jpeg.b0131fbf932b54e0a3001678d08260ef.jpeg

This is possible without too much trouble due to the wonderful multi-camera / post-processing / 2D rendering system.

  • Like 4

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'm using the render layers to draw the selected objects to a separate camera that is rendering to a texture, with a post-processing effect that highlights edges based on depth being less than 1.0. Then that image is applied to a sprite that appears on top of the scene, and viola, selected objects are highlighted. It uses three cameras, one for the main scene, one to render the selected objects, and then another for to draw the sprite with orthographic projection on top of the scene.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

UltraEngine_c.exe is updated, and the required post-processing effect is added. Sync your project to get the files.

This will highlight select limbs and meshes in blue, and when a material node is selected in the tree, all meshes that use that material will be highlighted with yellow.

The outline effect won't work in your game without a little extra setup. I'll add an example to show how.

image.thumb.jpeg.f89809e69260197cee989f5a38267510.jpeg

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

This is really awesome. There's virtually no need to pull up materials for models now. 

image.thumb.png.44ed1528b3d49aff58c02979ae378941.png

I Love the drop down to select new materials, but I found that loading in a lot of new textures and materials save within the session and can get a bit busy. I assume one the assets used are saved, and by instinct, right clicked on the material I wanted to delete only to find no functionality was present. I stumbled between switching to the mesh and material modes, but I think I'll get used to it.

I really adore the smooth scrolling, but it only seems to happen when the right mouse button is down. Please fix. Other than that, you don't need A and B anymore, this is so much better. 

  • Like 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Although it follows the same basic idea, there are a lot of differences between this and Leadwerks. In Leadwerks it was all about locking assets into one exact defined format, and Ultra is a lot more free-wheeling in this regard. This made the workflow for Ultra much harder to program and design, but the result seems very nice and powerful. With the rest of the editor, I don't think a lot of big changes are going to be needed. I think the rest will not take that long to write.

  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...