I am building a pretty big asset for my game. It’s a ship which contains lots of smaller objects.
Usually, when I have objects containing many materials, in the end I make one material from it and bake the ambient occlusion and one Diffuse texture out of the whole thing.
Now this monster has loads of objects and I am wondering if I should first bake the ambient occlusion for each of them or if I should just wait until the big final, when I have them all joined together and assigned one Master-Material…
How do you usually proceed with such complex objects? Do you do it as I do, joining everything together and keeping multiple materials, or even joining everything together and make one big material for all of them? (It doesn’t need to be HD, since the player cam is always some distance away)
Hello.
What I will do.
Simplified the fences to planes. Use texture.
Model small stuff (3D or pasted images), then bake. eg: life floaters, peephole, doors, anchor, etc.
It depends how this is going to be used in-game. If it is an environment for the player to walk around or something else rather big, then keep things separate. If it is a prop then do it as one or two textures/materials.
I finished the texturing phase.
Now I wanted to make the asset game-ready and I am stuck again.
I removed all materials and made one for all objects and saved everything in one mega texture…
The problem is that this mega texture was 4096-4096 and around 21 MB.
The game dropped crazy with the framerate.
I reduced the texture then to 1024x1024 but the result is one washed out texture…
The GPU has to do a certain amount of work for each pixel in an image. The more pixels the more work.
But scaling a texture by 2 doesn’t create double the number of pixels, it doubles and doubles again. Your big texture is actually 16 times bigger than a 1024x1024 texture, thats why it doesnt render quickly.
One of the best ways to do texturing of large set pieces like this is to re-use textures as much as possible. Make an atlas map with common textures for detailed parts, like vents, door handles, pressure gauges etc… use simpler materials for the more simple areas. The hull for example could be basic white and blue stripes with a dirt map overlaid and scratches as decals.
As Smoking_mirror said - reuse textures. Also for huge objects it is not suitable to use one big texture file. You can tile a 256x256 texture of wooden planks for the floor. Separate textures for lifebelts, mastheads and the ship’s hold gates and then reuse those textures anywhere that they may suite. Also if it is just an asset on the background you don’t need normal map or any other map except of diffuse map in the material. If you use light maps or AO maps make them very small like 512x512 they will look fine.
I’m still not convinced that one 4096x4096 would drop your frame rate so massively. Maybe there is something wrong with the model or the material, not the texture.
One very important thing when making textures, is not to mix in one texture elements using alpha channel with opaque elements. For instance - if you have 4096x4096 texture with alpha channel and more than 50% of the texture are actually opaque elements, that is not good.“Alpha” is famous frame rate killer. You need to separate alpha elements in different textures.
Also don’t save images with alpha channel if they are only opaque - that will save you tons of MBs and performance. For instance: default PNGs and TGAs are saved with their alpha channels, so you might have a lot of textures that are killing your performance because of that.
Thanks a lot for the advices!
In fact, I did everything wrong what you guys pointed out:
-I have backface culling off, so that the railings are visible from both sides, so I guess this will also decrease performance.
-The railing and the rope use alpha and they are stored within the same mega-texture, so I enabled alpha for it.
The original high resolution mesh is a mirrored object and most of the objects also use repeated textures or materials.
For the decals, I am not sure how to use them in blender, so I pasted them in photoshop.
But I will figure it out.
Would you join all these objects together into one object having lots of different materials or would you just leave them as single objects parented to the main object?
And is jpg the best choice for opaque objects?
I thought having so many objects/materials would decrease performance. But apparently my approach is the wrong.
The object has in total around 5.000 faces and I use a poor onboard laptop graphic card - intel hd 4000.
Many objects=slow performance. Many materials with small resolution textures are ok. Try to keep as little objects on the scene as you can. So yes, make it into one object with many materials applied on it.
Jpg is very fast image format, but it is not with very good quality, you can use png or tga without the alpha channels, but you can also use just jpg it is all up to you.
Blender is not the fastest engine out there, keep in mind big images will affect the performance no matter what you do.
The model looks great for its faces and 5k is perfectly fine.
Did you set all the faces to no collision? If not, do this to all the objects in the scene! Use only very simple invisible collision mesh for the actual collisions. This will give you maybe 50% more performance in the game.
Intel hd 4000 - making a game on that kind of video is good for you, you will learn much faster how to optimize your games.
Always use backface culling. If you want an alpha plane to be visible from both sides (like a railing or mesh window), duplicate the mesh in that area and flip the faces.
I tend to use two separate maps: One for the texture and another for lighting. This allows high-res rust-stains but still having good looking AO/shadows.
I also sometimes combine high res textures using another stencil texture, or sometimes a stencil texture added to a noise texture - this means you don’t get harsh edges where it transitions from one to the other.
Back face culling is when the renderer only renders one side of a plane to save performance. By flipping the direction of a faces “normal” the side which is rendered changes. You can do this in edit mode by selecting the face you want to flip, pressing space bar and typing “flip normal” in the search bar. If you disable back face culling, the renderer has to render both faces of an object, which is essentially the same thing as rendering 2x the amount of geometry. The only material where you should disable back face culling is double sided glass, when the player could be on either side of the glass plane, and even than its more efficient to use smoking mirrors solution and duplicate the mesh and flip the normals.
As for my input for texturing the ship, here is my idea. It seems to me that the reason you need so much detail for the hull texture is because of the rust spots. I would modify the texture atlas to have a blue/white paint area, a rust area, and some hard cloud noise. I would use the cloud noise to mix the hull and rust textures, which would probably save you a lot of space in your atlas.
I would modify the texture atlas to have a blue/white paint area, a rust area, and some hard cloud noise
I have the same problem as the OP, texture made at 4096 looks great a texture made at 1024 looks stretched out.
Now you say make a texture divide it to 4, so every square gets his paintjob?
but how do you get it so it wont be stretched out, if 1/4 on the texture is like blue/white paint, that means you have 256*256 resolution. If you unwrap the in this case a boat that single uv unwrap of that area is bigger then the texture space itself, then if you scale that down to fit the white/blue space it’s even worse.
What I’m suggesting is stencil mapping. This picture pretty much describes how stencil mapping works:
[ATTACH=CONFIG]463147[/ATTACH]
As you can see, the dark areas define where the first texture goes, and the white areas define where the second texture goes.
so, if you make a texture atlas for the boat, here’s what I would do:
In the material editor, add 3 texture slots. In all three slots, add the atlas texture (This atlas only needs to be 256x256)
Make the texture atlas with a paint and rust texture (Make sure they are side by side) and a hard cloud noise texture. The noise should be 128x256, so it is twice as long as it is high and twice as big as all the other textures.
In the first slot of the material editor, Unwrap the hull of the boat to use the paint texture. No other textures should be seen on the hull.
Disable the top texture (The highest one of the stack of textures, which is the paint texture in this case) and map the cloud noise to the hull.
Disable the noise and the paint texture, and map the rust (Which is in the third material slot) to the hull of the boat.
Re enable all of the textures. Now, you should only see the paint texture, because that is at the top of the texture stack. Select the middle texture in the texture stack (The cloud noise) and select “No RGB” and check the box marked “Stencil”.
Now the the cloud noise defines where the rust and the paint textures are applied, and the entire atlas can be far smaller because you do not need to show the entire hull in one texture.
If this short tutorial didn’t make any sense, I recommend looking up “Blender Stencil Mapping” on YouTube, so you can see all of the steps.
Hi, Thanks Grenzer. To gather my understanding together, if I uncheck backface culling, that means it is disabled? And this only works for textures ? or does it apply to materials too? I tried messing with backface culling, on a textured object and material object, but found no difference, it still rendered. ( I modeled a house, put texture on, but could still see the material and texture from both inside and outside the modeled house)
And to get things back on track with the topic, would a large textured ship be better off, texturing only a single face with rust, and then coloring in the rest with regular material? Or is texturing the entire object better?
Yes, back face culling is enabled by default. So long as the checkbox is checked in the material view, you are good to go.
Backface culling works for both materials and textures they go hand in hand.
you should not be able to apply a texture to an object without a material, unless you are in Multitexture mode. If you are using multi texture,I highly recommend switching to GLSL (Under the scene tab in the game engine) GLSL is much better than multi texture.
In the 3D view, back face culling is disabled by default. It only kicks in when you start the game engine by pressing the “P” key. To enable it in the 3D view, press “N” to bring up the right-hand toolbar, look at the display settings, and check the box to enable back face culling in the 3D view.
im not quite sure what you mean by your last question, but if you want to use only one texture, use the “Cube Unwrap” function on the mesh. To get more complex textures, I would recommend stencil mapping or some other method. Usually, if the texture has to be more than 2048x2048 for it to look good, you should look into alternatives for texturing it.