Jump to content

replacing world texture


IIYAMA

Recommended Posts

  • Moderators

Pls only reply if you know what a shader is.

If I replace the world-texture and I convert the texture(element) format to dxt5, will it still use 4 times less memory?

local texture = dxCreateTexture ( "text.png","dxt5") 
if texture then 
       dxSetShaderValue(texShader,"gTexture",texture) 
       engineApplyShaderToWorldTexture(texShader,indexName) 
end 
  
  

Link to comment

I do not exactly understand why does a shader-expert have to reply to you when you can find the information on dxCreateTexture Wiki article?

DXT5 compressed - Can take a fraction of a second longer to load (unless the file is already a DXT5 .dds). Uses 4 times less video memory than ARGB and can speed up drawing. Quality slightly better than DXT1 and supports crisp alpha blending.
Link to comment

It really depends on the contents of the texture itself.

DXT1 is for when your image has no alpha channel (fully opaque texture) and gets 8:1 compression. DXT5 supports an alpha channel, but only gets half the compression (4:1) of DXT1. The primary benefits are

- smaller apk size

- less data to upload to the GPU

- less data for GPU to read

Source: http://forums.ouya.tv/discussion/commen ... mment_8852

Additional links

The major thing you should understand is:

DXT1 - Quality not as good as ARGB

DXT3 & 5 - Quality slightly better than DXT1

This means, that ARGB obviously has the best quality over any of these, though uses more video memory and may be slower to render.

Sometimes you have to do compromises over quality, so just apply DXT1 on it if it has no alpha channel. Same goes to alpha channel images - so go for DXT3 or 5. But it really depends on how fast you need a texture loaded versus how much video memory is available. And keep in mind the significant rendering speed difference, as you are compressing an image.

If you want the best quality, go for ARGB. If you want to lose some quality but have it use less memory and be faster to render, go for DXT ones, and suit up the one which suits for your alpha channel needs.

Really helps if you test it out yourself.

Remember, that not everyone has a Quadro or Tesla, so that means the lowest amount of video memory someone can potentially have is 2 MB. Of course that would mean that they have no graphics card (only a default integrated card, which sucks and cannot be used for much gaming), or as high 12 GB. The current normal GFX cards come with 1 to 4 GB of video memory equipped, but 6 GB is also pretty common. So if I was you and I was developing some massive custom texture-based server with hundreds if not thousands of textures, I would calculate the amount of video memory I am going to be spending.

If your textures are 1 MB each, it is nothing compared to how much you can throw at the card; 100 MB = 100 textures, in that case. And if your card is equipped with 1 GB video memory, you can throw 1000 textures at it with the size of 1 MB each until you have to start ripping off some textures from further away. So to fix this issue of hitting the video memory capacity, you can just draw nearest textures, and then just avoid far textures, or lower the quality of those textures on-the-fly.

You should be considering these compressions only when you are actually developing a game with thousands of textures. Large MMOs can have hundreds of thousands of textures, and those are compressed by various of compression technologies on-the-fly while playing; in most games they are pre-compressed to reduce lagging or problems with texture loading. But that is a big subject and I am not an expert there, but just remember that video memory is not necessarily a thing to worry about until you actually start to reach a video memory limit point. I actually think you can see video memory usage in-game with one of the MTA default built-in commands.

TLDR: Yes, it uses 4 times less memory and speeds up drawing, but also eats some of the quality.

Edited by Guest
Link to comment
  • Moderators

Yes ARGB, has the best quality.

When I compare ARGB to DXT5, I hardly see any differences.

I am not going to use DXT1 and DXT3, DXT5 fits in as replacement of ARGB.

I am even recommend you it to use DXT5, in your scripts. ("large" images)

Also convert the images to textures (local variables) also does speed up your lua memory and quality of textures are better then from files.

Less people complaining about lagg, it is what you want. :)

My main question was, "does it also counts for shaders". But yes it does when I think with logic.

Link to comment
Yes ARGB, has the best quality.

When I compare ARGB to DXT5, I hardly see any differences.

I am not going to use DXT1 and DXT3, DXT5 fits in as replacement of ARGB.

I am even recommend you it to use DXT5, in your scripts. ("large" images)

Also convert the images to textures (local variables) also does speed up your lua memory.

Less people complaining about lagg, it is what you want. :)

My main question was, "does it also counts for shaders". But yes it does when I think with logic.

Yes, shaders or not, there is a significant drop in the amount of video memory that image is using. So therefore it does not matter if you have a texture and have applied it on a model, it will still lower the cost 4 times, though I recall shaders eat additional video memory, but that is not a significant value in this discussion.

When I compare ARGB to DXT5, I hardly see any differences.

Good, but sometimes when drawing detailed textures you might see the difference clearer. It always drops quality whether or not can you see the difference. Compression tries to keep the quality up, but as it compresses the image it has to drop some irrelevant parts out to lower the cost. If you find that DXT5 does not seem such of a bad idea, then go for it, especially if your texture seems alright to you.

Link to comment
  • 4 weeks later...

I've got 38 png files ( 3,25MB). I'm applying these textures to models (using shaders). I've noticed that converting them from argb to DXT1 (90% of them) DXT3/DXT5:

- Makes it 5 times longer to load (unless i also convert the files from png to dds)

- Takes 1/6 of the memory

- Saves 4 FPS average

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...