Jump to content
  • Advertisement
Sign in to follow this  
Scouting Ninja

OpenGL Could I replace my textures with shaders.

This topic is 379 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a large scale mobile game and one thing I notice is that mobiles are very bad with textures.

I started by making the textures in the game 2048* 2048 then because of memory limits I dropped down to 1024*1024. While doing basic profiling I noticed that my textures are by far the most graphical impacting factor even when using Unity's mobile shaders.

So I am thinking about discarding textures or at least dropping them down to 256*256 or 128*128 for basic info only.

I would use Unity materials with tiling textures to create material types. A screen space Ambient occlusion shader. No normal maps as I would instead increase the polycount, I noticed that replacing my models with higher poly models has very little impact. I could use very basic vector calculations to blend colors, think matcap shaders.

Matcap shaders would be key to this looking good.

 

My question is: Would something like this even work? Cell shaded games is the nearest I have seen to this concept, yet they often rely on heavy composing that reduces all benefits.

Wouldn't the extra draw calls reduce my performance gain? I could switch to Unreal to do this as I noticed it has a much better performance with complex shaders and it's instanced material system even works on animated objects.

Share this post


Link to post
Share on other sites
Advertisement

Don't know much about mobile but what kind of texture compression you using?  Also doesn't mobile have compression techniques unique to it?  I forgot what the format was called.  Beyond that the only two other things I know of.  First is that both unity and unreal support https://www.allegorithmic.com textures.  And you could always implement virtual textures and stream from secondary storage.  Thats about all I can suggest... anyway at least I bumped your topic.

Share this post


Link to post
Share on other sites

I'd also double check that texture compression works properly. AFAIK each vendor has it's own codec. Probably Unity supports them all but maybe you need to enable it somehow.

Those matcap shaders seem just spherical enviroment maps, light would be 'attached to the camera', so in practice you are limited to a camera that should not rotate much. But you could code a similar look procedurally in pixel shader to support dynamic lighting.

Share this post


Link to post
Share on other sites
2 hours ago, Infinisearch said:

Don't know much about mobile but what kind of texture compression you using?  Also doesn't mobile have compression techniques unique to it? 

8 minutes ago, JoeJ said:

I'd also double check that texture compression works properly. AFAIK each vendor has it's own codec. Probably Unity supports them all but maybe you need to enable it somehow.

I already use the recommended compression and yes Android and IOS has different ones they use. My compression here isn't really the problem it's the volume of textures.

I use a Diffuse, Normal and Gloss on almost all the models with some even having Detail, height and alpha textures. I could go with less textures but then I don't get the look I want.

This is mostly my mistake. I notice a lot of the mobile games don't use many extra textures.

 

2 hours ago, Infinisearch said:

First is that both unity and unreal support https://www.allegorithmic.com textures.

I have been using tiling with Substance and in fact it could be way I have problems with my textures.

To create the complex materials I would start with a basic grain at 64*64 Tile it 16 times to get the 1024 texel density. Then I would use the next detail like cracks at 128*128 Tile it 8 Times to match the other textures.

So to match all parts of the material I tiled each texture on it's own. Now that I tested with my Matcaps I noticed that mapping the UV map is much faster on mobile than mapping a texture.

On PC it doesn't matter if I tile the UV or textures it's the same cost. On mobile tiling the texture is 5-6 times slower and every texture tiled reduces the performance.

 

It's funny how a performance saving trick for PC makes things worse on mobile. I could save performance by just baking it to a single material set but it won't be as flexible as it is now. I want to be able to reduce graphics for lower mobiles without needing separate texture packs.

32 minutes ago, JoeJ said:

Those matcap shaders seem just spherical enviroment maps, light would be 'attached to the camera',

The camera is at a constant angle so this is little of a problem. Mostly notable when the player adjusts.

 

I am actually getting good results. I did not get the huge performance boost I was hoping for and I am still working on the look. I did get other advantages as the game is now 1/4 of the size.

I should have the basics working on a test model soon, so that I can show what it looks like.

Share this post


Link to post
Share on other sites
51 minutes ago, Scouting Ninja said:

It's funny how a performance saving trick for PC makes things worse on mobile. I could save performance by just baking it to a single material set but it won't be as flexible as it is now. I want to be able to reduce graphics for lower mobiles without needing separate texture packs.

You could downsample and combine the textures at startup, but probably recompressing takes too long :( Maybe putting 3 lods of baked textures with the app is an option. 

Dynamic / layered material systems are the root of many performance issues i guess. Unity / Unreal makes it too easy to use it ;)

 

Edit: Ghost Recon Wildlands does texture recompression per frame for incoming tiles of terrain, so maybe it is faster than i think.

Edited by JoeJ

Share this post


Link to post
Share on other sites
5 hours ago, JoeJ said:

You could downsample and combine the textures at startup, but probably recompressing takes too long  Maybe putting 3 lods of baked textures with the app is an option. 

Something for me to try in my next mobile game. I will have to fix this at some point but for now I like the style I discovered. The other thing is I am getting more crisp results with matcaps and the high dpi screens.

Honestly I am hoping to solve this by just waiting for the mobiles to upgrade. I don't have any rendering problems on the new mobiles. For now I could just work around it by trying different art styles.:P

 

I spend most of the afternoon working on this, doing tests and deciding on the final look.

So I made some basic Matcaps and a basic test model. I was really lazy with the test model and just used Blender's auto shadow map to make a quick shadow map for it. This was a mistake as it pushed the vertex count to 22140 for a 7 380 tri model. I will use proper shadow maps for my final models.

Concept in Blender:

Spoiler

Concept.jpg.7b80c44b3703c34b312bc0dce8f9f5ca.jpg

The above image shows what I am more or less aiming for. I like this look, reminds me of the old school RPGs. I think with some outlines it could even look 2D. This would be nice as I notice mobile users are reluctant to download 3D games.

My progress in Unreal:

Spoiler

Unreal.jpg.df98c988b716167746ec48f45820cfd0.jpg

The above image doesn't look like much, but it is important to note that this was taken using a emulator. This is what it looks like on mobile now. I still have to add the screen space AO and bake shadow maps; both these Unreal will do for me. Then I want to blend the matcap colors using the vertex colors, this should provide even smoother looking colors, I hope.

I decided to switch to Unreal. The performance tests I did this afternoon proved it will be better for what I am planing. Besides if I wanted I could just move back to Unity at any time.

Performance is great at the moment. I can replace one of my old models (around 2 000 tri) with 4 of these (around 30 000 tri). I expect even more gain when I optimize the shadow map.

The other benefit is that my old models are around 6 MB before compressed where these are less than 500 KB. It roughly works out t a quarter of the size after compression. This was what I predicted as there isn't much to compress in the smaller files.

 

I will now need to re-make all my models for my game:

Spoiler

BakedNormals.png.e09abff8511f53b76a7b454c6aad1278.png

One thing my new models need is for the normals to be baked into the mesh, none of my old models where made for these.

In the above image the regular low poly model can be seen on the left. The middle one has the baked normals. The one on the right shows the wire frame, note the bricks as they have to be all modeled in now; where I would have just used a cylinder and some textures.

 

Conclusion:

I have some better understanding of what my texture problem is. At the moment it looks like my understanding of the mobile rendering pipeline is wrong. I have decided that this work around would be better for my end goal even if it means I will need to start the game over.

There is some real benefits to gain from using matcaps like this. It also produces a art style not common among mobile games that should set the game apart from the rest. Mostly I want the reduction in size.

Share this post


Link to post
Share on other sites
On 02/11/2017 at 10:47 AM, Scouting Ninja said:

Matcap shaders would be key to this looking good.

Rogue Singularity uses a load of matcaps, if you're looking for an example. They're good if you want stylised lighting that doesn't necessarily match the surroundings, and don't have local material details (e.g. Polished metal works, a brick wall doesn't). In suitable situations they look super pretty and are super cheap. You can add local details with vertex attributes and tiling texture overlays. 

Share this post


Link to post
Share on other sites
6 hours ago, Hodgman said:

Rogue Singularity uses a load of matcaps

Thanks for that. I am looking for games that use matcaps.

I have noticed there is a lot of matcaps in games. For example in State Of Decay they are used for the chrome effect on vehicle, many sell shaded games use them to fake the shading, some games use them to light the inventory items.

When you really look for matcaps you can find them everywhere.

6 hours ago, Hodgman said:

doesn't necessarily match the surroundings, and don't have local material details

I am noticing this a lot now. My game has a lot of caves and as a result needs a lot of rough material.

For now I am going to try doing the local details using the mesh, however it does look like I will need to add normal or bump maps in again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!