StandardShader

Posted By: 3run

StandardShader - 02/10/20 20:54

There is this awesome StandardShader for Acknex made by MasterQ32. It's HLSL Reimplementation of the Gamestudio Default Shading. With normal maps and per pixel lighting.
But there is an issue in it:
Quote
std_lightmapped is not yet right
std_normalmapped_lightmapped is not yet right
Maybe some shader gurus could fork (+pull request) and finish it? This could be super handy to use instead of outdated standard shaders.

Best regards!
Posted By: txesmi

Re: StandardShader - 02/21/20 16:31

Hi,
I gived a try to this and had tons of troubles. I forked it and uploaded my attempt here.

The main trouble is that the 'vecLight' vector has completely different values for blocks and entities. 'vecLight' is the only reference to PVR and overall ambient value so its usage is a must in order to get 'camera.ambient' implemented, but it happens that it has very strange values on blocks. After hundreds of tries and samples I arrived to undertand that blocks receive a 'vecLight' vector as follows:
Code
amb_factor = camera.ambient + ent.ambient + ...;
amb_average = (ambient.r + ambient.g + ambient.b) / 3;
vecLight.r = (ambient.r + amb_factor + 128 - amb_average) / 255;
vecLight.g = so on...

Pretty weird, isn't it? The only solution I can think on is to compute the inverse operation in order to get the 'amb_factor' value and aplly it in the lightmap. Works but wtf?

Once I solved this issue I tried to equalize the 'vecLight' passed to entities so it results in a similar colors of blocks but I have been unable.

It happens that terrains always receive 'vecLight' with the ambient value only, as far as I tested.

I also realized that sky blocks are rendered with 'mtl_sprite' material instead of 'mtl_sky'. I have been unable to make a samplerCUBE work over block sky textures so I could not overwrite the material.

At the end it works pretty well but far from the engines render output. Maybe someone want to give a try...

Salud!
Posted By: 3run

Re: StandardShader - 02/21/20 19:40

Man, it looks so awesome! laugh You are the shader master!

BTW, demo is missing two skins (used by box.mdl) test.tga and test_n.tga. I think it would be awesome if you make pull request to merge your version with the original one! :>

My best regards! Heil to the shader king!
Posted By: txesmi

Re: StandardShader - 02/21/20 20:33

hey! thank you, man grin

Just uplodaded the missing textures. I need to search for shareable models, textures and normalmaps. I suspect I am breaking the licenses of the ones I used xP
Posted By: 3run

Re: StandardShader - 02/21/20 20:39

Hehe, maybe you can find something in this models (I'll look for some models+textures too)
Free models from FPSC

Edit: I guess I've found something useful! Will send them to you via PM.
Posted By: txesmi

Re: StandardShader - 02/21/20 22:00

Received!

Thank you again wink
© 2024 lite-C Forums