I’m working on assets for clothing stores, and I need extremely low poly meshes for the commodities since there can be such a large number of them in view. I thought at first that stacks of shirts would be easy to optimize as just as a cube (or partial cube) with a clever normal-mapped texture; but it’s not that simple since at close range the straight sides are too noticeable. Just for reference, here’s a photo of the type of thing I’m trying to emulate:
Any ideas? I had thought about using a volumetric raymarching shader on a cube to produce a stack of flattened “roundcubes”, but that might get a bit tricky, and it’s a heavy shader.
How about adding few more polygons to the cube? Just enough of them to address jagged side issues?
If I remember correclty, games like GTA address this problem by displaying flat texture when the shelf is seen from distance which then switches to a more detailed 3d model… but they normally use it for the store fronts.
Another option is alpha cutout surface for the front of the clothing, but that probably will look horrible anyway.
Raymarching will be incredibly expensive, by the way… unless the volumetric model is stored as some sort of distance field, but even in that case I’d expect the cloth stack to take quite a bit more memory than a normal clothing mesh.
It would also help if you explained whether you’re trying to minimizze polycount or draw call count and if you’re actually experiencing performance issues. Depending on your target platform there’s a chance that you can collapse the whole shelf into one mesh and the performance will be acceptable.
A quad that has the cut out shader in front of the cube (but larger) will do, smart use of color will blend it while keeping the silhouette, since it’s only seen from a small angle range (you can never see it from the side, there is parallax with the depth and it’s multiple object so they will overlap and occlude each others)
Well, I’m hoping to reduce both polycount and draw call count. I’m planning to deal with the latter by writing a shader which adds random variation (color, pattern etc) based on worldspace location (i.e. with small “zones” of X by Y units), so that different stacks of shirts can all use the same material and therefore be batched while still having a lot of variety, so long as each stack fits snugly within “zone” boundaries, which is easy to do.
One idea I just thought of, but haven’t had any experience with: could I use a shader which tessellates a cube at closer ranges and then moves the vertices into an undulating pattern on all sides (a simple sinewave should do it)? I’ve never written tessellation shaders before, but I have experience with modifying the vertex position.
I had thought of that, but if even a small portion of the side is visible then that method doesn’t look correct. I suppose I could have the stacks stuffed right up against each other and stacked all the way to the bottom of the next shelf (as some stores do); in which case I could just have a single quad for all the stacks along an entire shelf. But I think that might look a bit cheesy at close range.
You know, you could indicate material(pattern) of a stack via vertex color.
Make X stacks with the shelf as a single mesh, use different color on each, then determine material in the shader based on vertex color.
Also, I wouldn’t try to alter stack’s form via geometry shader. It’ll most likely look too artificial.
I could blend the sinewave pattern with a noise pattern so it doesn’t look as regular (for changing the vertices into an undulating pattern for the folds).
The problem is you’re trying to define feature of a clothing stack as a procedural object. I wouldn’t do that, unless I have some sort of authoring tool to fine-tune parameters - it is a good way to waste a lot of time and get poor results, especially since you also need to think about textures and such.
Honestly, I’d advise to run your scene through unity profiler and see if you even have performance problem that needs addressing.
I’ve done some tests which indicate I’m going to have to optimize stuff like clothing on the shelf, due to the large amounts of it in a real clothing store. I’ve seen some games which settle for a very sparse amount of products on shelves, which looks unrealistic.