Jump to content

Shader Question


codeluaeveryday

Recommended Posts

I'll simplify this out, I have a (steve.png), that is the minecraft steve. He is 64x32 in size. Now I have imported him into MTA using a DFF and shader to apply it. When I apply a 64x32 image, it anti-aliases it and sizes it up. So I have to use Paint to resize it to 1024x512, and now it looks better.

So my question is:

How can I make my shader or Lua script change the size from 64x32 to 1024x512, the main reason is I don't see why players should need to download a 5kb file over a 1kb file? Please remember NO ANTI-ALIASING :\

I've also tried this:

dxSetTexturePixels(theTexture, dxGetTexturePixels(theTexture), 0, 0, 1024, 512) 

Link to comment

No shit cody, but lets look at what happens when there is 100 skins, which there is well over 1 million registered minecraft skins.

We are hoping to have at least 500 as we go on. Heres the other maths:

500 * 5 = 2500kb for one client, another 100 unique players a day:

2500 * 100 == 250, 000. Once again lets check the 30 day bandwidth usage:

7.5gb.

Now assuming each 64x32 image is less than 1kb?:

500 * 1 = 500kb, 100 unique players a day:

500 * 100 = 50, 000, this is for one day of bandwidth (50mb), now lets see the 30 day:

1.5gb.

Cody. I understand you are only trying to be normal, but you should know that optimization is everything in programming. There can never be enough of it. I'm actually a bit angry at you lol, its just because you are thinking of the small scale, when there is at the bigger scale side of it.

I hope that someone figures out how to add a texture filter method as it will save people A LOT of bandwidth and time.

Link to comment

Callin me normal foo Now, Thing is I dont think small scale, I said 5kb aint nothing in terms of regular modding, Though now that I accually take a look at this topic Maybe it could be if you have 500 skins Though 5kbx500 is 2500kb 2.5 mb Though theres a work around with the right type of scripting Minecraft doesnt download it, They just sync the skins. If you are worried about bandwith while downloading or Syncing Finda better server host. But lets say that doesnt work, Make it so when A person leaves and another person joins it doesnt download the skin for the person who just joined, But then if the person joins again tryn make it so it will download the skin for the person who hasnt downloaded it.

Link to comment

Once again it's not the server I'm fully worried about. Plus we are hosting just over 8 servers on our dedicated, yes I like to share. We do have a pretty expensive dedjcated ser er and have a shit ton of bandwidth. I'm not fully worried about bandwidth on our server, what I don't want to do is waste our clients time with having to download that shit. On top of that, seriously man. Just shut up and take this as a good suggestion. And I already know how to resize images.

Link to comment
-_- "Just Shut up" well im just tryin to help theres many ways to compress TXD files not just the pictures in them Now this is last time ima post here cuz your a :~ :) dont have to Tell me to shut up when Im just tryin to say compress them into a smaller image and the TXD will load them just as it would the other image but with A smaller download, You need to configure the settings for the pictures in the TXD editor
Link to comment
what I don't want to do is waste our clients time with having to download that

Cody just explained you how you can avoid that, even with 5 KB images. Cody took the effort to write down some information that could possibly fix the issue you're having and then you're telling him to shut up? That's not really how things work around here. How about an apology and some appreciation for his help?

Link to comment

You think I'm trying to compress TXD files? If you knew anything about what I am trying to accomplish, you would at least know the TXD files are a compressed format. Just listen to what eAi said, he is completely correct. That is the feature which is needed in MTA, it won't only help with this type of script. Cody, can you please stop replying, you've been useless and unhelpful since you joined.

Dude please, you literally have no idea what I am doing here. It's really basic stuff too, I'm sorry that you find this difficult, and yes I know how to work a TXD Editor. When you've been doing this for 8 years, it kind of syncs in.

I understand why you would want an apology. I've been on a very short string, and it's only getting shorter. The problem is that Cody has not actually given a solution to my question. My question was related to removing the anti-aliasing on the texture elements. eAi was so kind enough to provide a proper answer, which has helped me a bit with understanding how to implement it. I've ran into a few issues, and as have my friends. We need a different method to the one which eAi offered, it's very close though. We need a method which factors in the SamplerRate and the Texture in the same method, I know it probably won't exist.

It's just every method he has mentioned revolves around me forcing my clients to download more file size when they really don't need to. This is the problem with over 70% of the MTA:SA community. They constantly fail to realize the importance of stability, I go to some servers and I see 100's of megabytes needed to be downloaded. Then when I'm in the server, I think to myself, I know a few different methods that could get the exact same result for a lot less file size. I'm not mad at Cody, I just find his answers to be irrelevant and unhelpful. Mainly because I've already considered them, and I would like to give my players the best that I can give them. In Australia we are raised and taught to respect your clients and people which trust their data with you. It's why Australia has one of the best business ethics in the world. I just don't want to be that 1 server which doesn't look at for the number 1 picture, the people which bring the server to life, the community.

I'm being a bit of a jerk, I realize that. It's not his fault, he seems like a nice guy. I'm not going to ramble about my life here, this is just an apology. I'm sorry for being rude and unappreciative of the time you put into trying to help me.

Link to comment
I don't know if you want to go that far, but you could try to convert the image file itself clientside and scale it up - requires much work but safes bandwith and weird shader workaround that may not even work

Yeah that was one of my first ideas, but I don't want to cause any possible performance issues with the client. Still I can agree with you on this one, but I will avoid it until I know there is no other answer. I would prefer to download the 5kb also over this idea, but gj anyway.

Link to comment
I don't know if you want to go that far, but you could try to convert the image file itself clientside and scale it up - requires much work but safes bandwith and weird shader workaround that may not even work

Yeah that was one of my first ideas, but I don't want to cause any possible performance issues with the client. Still I can agree with you on this one, but I will avoid it until I know there is no other answer. I would prefer to download the 5kb also over this idea, but gj anyway.

Look below:

You'd need to set the texture filter mode to nearest neighbour (see here). Unfortunately MTA doesn't support this. It think it would be fairly easy to add it to dxCreateTexture though.

This gave me an idea. Since You need shaders to apply the texture to the entity anyway, how about changing texture filtering modes as well. http://msdn.microsoft.com/en-us/library ... 85%29.aspx

// 
// Example shader - filter_simple.fx 
// 
  
  
/////////////////////////////////////////////////////////////////////////////// 
// Global variables 
/////////////////////////////////////////////////////////////////////////////// 
texture gCustomTex0 : CUSTOMTEX0; 
  
/////////////////////////////////////////////////////////////////////////////// 
// Techniques 
/////////////////////////////////////////////////////////////////////////////// 
technique hello 
{ 
    pass P0 
    { 
        // Set the texture 
        Texture[0] = gCustomTex0; 
        MinFilter[0] = Point; 
        MagFilter[0] = Point; 
    } 
} 

Link to comment
I don't know if you want to go that far, but you could try to convert the image file itself clientside and scale it up - requires much work but safes bandwith and weird shader workaround that may not even work

Yeah that was one of my first ideas, but I don't want to cause any possible performance issues with the client. Still I can agree with you on this one, but I will avoid it until I know there is no other answer. I would prefer to download the 5kb also over this idea, but gj anyway.

Look below:

You'd need to set the texture filter mode to nearest neighbour (see here). Unfortunately MTA doesn't support this. It think it would be fairly easy to add it to dxCreateTexture though.

This gave me an idea. Since You need shaders to apply the texture to the entity anyway, how about changing texture filtering modes as well. http://msdn.microsoft.com/en-us/library ... 85%29.aspx

// 
// Example shader - filter_simple.fx 
// 
  
  
/////////////////////////////////////////////////////////////////////////////// 
// Global variables 
/////////////////////////////////////////////////////////////////////////////// 
texture gCustomTex0 : CUSTOMTEX0; 
  
/////////////////////////////////////////////////////////////////////////////// 
// Techniques 
/////////////////////////////////////////////////////////////////////////////// 
technique hello 
{ 
    pass P0 
    { 
        // Set the texture 
        Texture[0] = gCustomTex0; 
        MinFilter[0] = Point; 
        MagFilter[0] = Point; 
    } 
} 

Brilliant :D

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...