david.warford Posted May 14, 2020 Posted May 14, 2020 I am currently working on a game which will make heavy use of unlit bill boarded planes with pixel art on them, however i can't find a way to disable texture filtering on the texture I'm using. Below you can see a terrible image which should be nice and crisp. i would like it to look nice an crisp like that image was achieve by using a higher resolution texture. but that is wasteful
morbid Posted May 14, 2020 Posted May 14, 2020 At the moment you can't get crisp edges with low-res texture and Alpha Test/Alpha Blend material preset. We can think of implementation. Can you tell more about the desired visual style of your game? Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
david.warford Posted May 14, 2020 Author Posted May 14, 2020 What I want is some material which has no lighting, transparency is either fully transparent (discard) or fully opaque. and has no texture filtering so that low res textures would still look nice. The idea is we would like to use unigine's full potential for visual fidelity for our environments, but would have sprites similar to early 3D games that always face the camera with low res but sharp looking textures.
werner.poetzelberger Posted May 14, 2020 Posted May 14, 2020 (edited) Write a shader or own material? Love the PixelArt Look btw.. ;) Edited May 14, 2020 by werner.poetzelberger 1
david.warford Posted May 14, 2020 Author Posted May 14, 2020 Yes i was thinking this may be the direction I have to go but I don't have much experience with this. I was under the impression that texture filtering was an aspect of the texture it's self when sent to the GPU and that unigine would be setting the filter mode on the texture when it is sent to the gpu
david.warford Posted May 21, 2020 Author Posted May 21, 2020 Okay so I went and made a shader to try and remove texture filtering and so far it has not worked // Include the UUSL language header #include <core/shaders/common/fragment.h> // Adds a texture sampler (slot 0) INIT_TEXTURE(0, TEX_COLOR) STRUCT(FRAGMENT_IN) INIT_POSITION // Projected position INIT_IN(float4,0) // Texcoord (uv) INIT_IN(float3,1) // Vertex TBN (X) INIT_IN(float3,2) // Vertex TBN (Y) INIT_IN(float3,3) // Vertex TBN (Z) END MAIN_BEGIN_DEFERRED(FRAGMENT_IN) // Get the UV coords float4 texcoord = IN_DATA(0); // Get the texture data float4 texture_data = TEXTURE(TEX_COLOR, (floor(texcoord.xy*textureResolution(TEX_COLOR))+0.5)/textureResolution(TEX_COLOR) ); texture_data = texture_data; // Define the normal of a fragment in tangent-space STATICVAR float3 tangentspace_normal = float3(0.0f,0.0f,1.0f); // Calculate the view-space normal float3 viewspace_normal; viewspace_normal.x = dot(IN_DATA(1),tangentspace_normal); viewspace_normal.y = dot(IN_DATA(2),tangentspace_normal); viewspace_normal.z = dot(IN_DATA(3),tangentspace_normal); viewspace_normal = normalize(viewspace_normal); // Fill G-Buffer: set the calculated normal and albedo color of the texture GBuffer gbuffer = GBufferDefault(); gbuffer.albedo = texture_data.rgb; gbuffer.normal = viewspace_normal; setGBuffer(gbuffer); MAIN_END // end this should quantize the texture resolution so it falls on a grid but it doesn't quite work, below is the result i get from the low res texture and below is the expected result as you can see there are some pretty heavy artifacts, it would be nice if there was a nearest neighbor filtering option
david.warford Posted May 21, 2020 Author Posted May 21, 2020 it was only shortly after that i noticed my issue, setting the image format to rgba8 fixed it
Recommended Posts