What do y'all think about this Conveyor Item Mesh Material

I am looking to color Conveyor Items using Vertex Coloring and threw this Material together to complete that task. I think this is less expensive then FactroyBaked, expecially because I am looking to re-color items. I do not have a lot of knowledge in this area tho, and would appreciate feedback.
No description
13 Replies
AngryBeaver
AngryBeaver•3w ago
Feed Normal map data into roughness is hard wrong and should not be done. But when it comes to vertex colouring it may be cheaper than a texture; however, without any texture maps like you're showing there your stuff will be bland, cartoonish and not fit the visual style of the game Introducing a new shader trying to micro optimize something that usually isn't the rendering pipeline wont really improve anything. Not to say that there aren't worries about VRAM. but pre-=emptive optimization is the root of all evil why do you feel the need to try and improve performance at the cost of visuals this badly?
MrWolf
MrWolfOP•3w ago
Because it is one of two options I could determine to change the color of dynamically generated item at runtime. The other thought I had was to make a texture with all possible colors on it and shift the UV Map. However because I am just using RGB CYM WB and Gray, there wasn't a need to carry the texture, nor the UV Maps. As I can just chuck a color on a vertex... which I believe is cheaper when I dynamically generate a static mesh from up to twenty other static mesh. One material. Honestly I might want to drop the normal map, but it's what provides that detail you're talking about. The fact this might be lighter weight is very good news. I'm building Shapez 2, Shapes in Satisfactory. So this should... be a much better way of handling it. Thank you AngryBeaver, you always have the best advice on the rendering pipeline. Wish I could just download all your knowledge in one go without annoying you 😆
MrWolf
MrWolfOP•3w ago
@AngryBeaver (FE, CC+) Mr. Beaver, why might it be a terrible idea to just feed the normal map into Roughness? Guessing a constant like this would be better either way. But figured I'd want variations in the Roughness so just fed the normal map into it... guess it makes sense because both are acting on how light is handled.
No description
AngryBeaver
AngryBeaver•3w ago
If you understood what normal data represented and what roughness data represented you'd realize it's not just "some variation. but a strictly defined shape with mathematical rules. meaning only the north side of your object would be shiny. for example since you're trying to implement Shapze why are you even using normals or normal maps? The meshes you use to make the objects themselves will have enough normal data which by the way how are you doing if they're procedural? have you tried looking into the procedural mesh generation tools UE has now?
MrWolf
MrWolfOP•3w ago
I have looked into different methods to generate the shapes. Without adding plugins, it would seem creating a new mesh and mesh descriptor and subsequently merging a bunch of static mesh descriptors into it, and finally using that new mesh as a conveyor mesh for a ItemDesc, gets me most of the way there. The normal map, specifically the panel normal map, give me depth and detail without costing me triangles. Trying to keep each primitive under 40 triangles, so... if I have 5 stacks of 4, still keeps us relatively low on the triangle count at around 800. For conveyor items I'd really like to stick to 400 or less.
AngryBeaver
AngryBeaver•3w ago
Normal maps are for finer levels of detail than you actually need in your meshes if they're geometric shapes, maybe you will be able to bevel the edges slightly but that's going to require some technical finess to get looking right I'm not sure most people would try. I suggest you accept a marginally higher polycount and do LODS than try and add a normal map to it.
MrWolf
MrWolfOP•3w ago
Did this real quick. Thought it might be funny to emboss Ficsit on all of the pieces with a normal map 😆 Figure you'd say its a waste of processing power lol
No description
Rex
Rex•3w ago
You're better off using multiple scalar parameters instead of trying to use a vector for metallic and roughness Also, is there a reason why you're not using, say, Asset_Master? What's the domain of this material?
MrWolf
MrWolfOP•3w ago
Reason is Vertex Coloring isn't supported by Asset_Master. Not sure what domain means in this context. This material is just, a new material... so it doesnt inherit the others. purpose was to ensure it was super light weight and I could re-color items without changing Material.
c++
for (int32 LOD = 0; LOD < ShapeLODCount; LOD++) {
FMeshDescription* SourceMeshDescription = BasicShapeLib[NewShape]->GetMeshDescription(LOD);

TVertexInstanceAttributesRef<FVector4f> VertexColors = SourceMeshDescription->VertexInstanceAttributes().GetAttributesRef<FVector4f>(MeshAttribute::VertexInstance::Color);
for (const FVertexInstanceID& VertexInstanceID : SourceMeshDescription->VertexInstances().GetElementIDs())
{
// Get the current vertex color
FVector4f CurrentColor = VertexColors[VertexInstanceID];
FColor CurrentFColor = FColor(CurrentColor.X * 255, CurrentColor.Y * 255, CurrentColor.Z * 255, CurrentColor.W * 255);

// Check if the vertex is red, we use RED as our default color.
if (CurrentFColor == FColor::Red)
{
// Update to the new color
VertexColors[VertexInstanceID] = FVector4f(NewColor.R / 255.0f, NewColor.G / 255.0f, NewColor.B / 255.0f, NewColor.A / 255.0f);
}
}

FStaticMeshOperations::AppendMeshDescription(*SourceMeshDescription, *AllNewMeshDescriptions[LOD], AppendSettings);
}
c++
for (int32 LOD = 0; LOD < ShapeLODCount; LOD++) {
FMeshDescription* SourceMeshDescription = BasicShapeLib[NewShape]->GetMeshDescription(LOD);

TVertexInstanceAttributesRef<FVector4f> VertexColors = SourceMeshDescription->VertexInstanceAttributes().GetAttributesRef<FVector4f>(MeshAttribute::VertexInstance::Color);
for (const FVertexInstanceID& VertexInstanceID : SourceMeshDescription->VertexInstances().GetElementIDs())
{
// Get the current vertex color
FVector4f CurrentColor = VertexColors[VertexInstanceID];
FColor CurrentFColor = FColor(CurrentColor.X * 255, CurrentColor.Y * 255, CurrentColor.Z * 255, CurrentColor.W * 255);

// Check if the vertex is red, we use RED as our default color.
if (CurrentFColor == FColor::Red)
{
// Update to the new color
VertexColors[VertexInstanceID] = FVector4f(NewColor.R / 255.0f, NewColor.G / 255.0f, NewColor.B / 255.0f, NewColor.A / 255.0f);
}
}

FStaticMeshOperations::AppendMeshDescription(*SourceMeshDescription, *AllNewMeshDescriptions[LOD], AppendSettings);
}
This is how I merge a mesh into our new mesh. This lives inside a few other loops, because we need to grab NewColor and NewShape, for every shape we want to add to the new mesh. CuCuCuCu, has four gray quarter circles, for example. I could instead translate a UV Map across a texture, but I'd think vertex coloring it would be less expensive, because the GPU doesnt have to walk across a texture, and instead just interpolates the constant. I've written Shaders in Adobe Graphis Assembly Language when Flash Was a thing. Shading this with agal would be cheaper as Vertex colors instead of Textures because we wouldnt need to sample our texture... but technology has changed and this isnt AGAL so I'm using an out of date understanding of how GPU's actually render this thing...
Rex
Rex•3w ago
Hmmm, what exactly does vertex colouring do here?
MrWolf
MrWolfOP•3w ago
well, four vertex colors are Red, the rest are essentially black. 0.15 Value 0.0 Saturation and Hue. Using Vertex Color as base color, it colors our quarter square. But more importantly, if I grab all of the red vertex, and change them to blue. Now our shape is blue, without changing material. If I add a red square, then a blue square and a red circle and a blue circle RrRbCrCb, then all in one shape, using the same material as every single other shape... I now have a red and blue checkered square circle shape
No description
Rex
Rex•3w ago
For colouring only, you can do this using UVs https://discord.com/channels/555424930502541343/1036634533077979146/1303426540196860049 It's a bit convoluted because I wasn't in the mood to play around with UV mapping to simplify it
MrWolf
MrWolfOP•3w ago
I could yea... I could use a texture like this, and then shift each of the UV's to each of the colors they belong in by applying a translation to only the vertex points that belong to the color we need to change. Its a bit more computationally expensive to generate them, but if its cheaper to render them... I would definitly go that route.
No description
Want results from more Discord servers?
Add your server