[QUOTE=Sonoshee;24291]Hey Hyllian! I’ve created an account to ask a bit of help regarding the cg shaders. So I’m a beginner when it comes to shader programming and I wanted to use the xBR (x2 the native resolution) shader in my Unity game. A very kind member of the community helped me exporting ( actually he did the whole thing, I was just watching) the cg shader into a shader compatible with Unity, here is a link to the post : http://forum.unity3d.com/threads/how-to-copy-paste-a-cg-shader-found-on-the-internet-in-unity.334772/#post-2181555 So the shader compiling is throwing no more errors thanks to Lanre, but I have no idea what to fill these values with : half2 video_size; float2 texture_size; half2 output_size; Lanre said they’ll need to be filled with a Vector4 value ( 4 floats, X, Y, Z, and W), but the screen is always white regardless of the values I set from within the script that controls the shader. I was also doubting about whether the cg shader that was exported works to begin with ( link in my Unity post). HELP! I must say my game looks gorgeous with the xBR filter applied to it ( through an image scaler that uses the algorithm)[/QUOTE]
These three vars are uniform vars used by Retroarch.
video_size is the size of the frame being filtered. So, if it is a snes game, it’s the native res of that system, that is 256x224. texture_size is the size of the texture where the video is copied in. In Retroarch texture_size is always power of two in both dimensions. So, it can be 256x256, 512x256, 512x512, 1024x1024 and so on. You should know the size of the texture you use for your game. output_size is the size of the output texture already filtered. So, if you had a snes game and upscaled it by 4x, it should be 1024x896.
So, in other words, this is what happens when you run a snes game in Retroarch with xBR and wants to upscale by 2x:
1- You set Retroarch and run a snes game which has 256x224 of native res. 2- Retroarch allocates a texture power-of-two to accomodates the snes frame. So it allocates a 256x256 texture. (this is indeed what matter for xbr calculations) 3- to upscale by 2x, the final output res should be 512x448. Which means output_size is 512x448.