Sign in to follow this  
WorstParadeEver

Understanding this model effect

Recommended Posts

Hooked DrawIndexed in this game and I'm trying to just set the pixel shader to a red color

 

http://i.imgur.com/8NcSrXn.jpg

	char szCast[] = "struct VS_OUT"
		"{"
		"    float4 Position	: SV_Position;"
		"    float4 Color		: COLOR0;"
		"};"

		"float4 main( VS_OUT input ) : SV_Target"
		"{"
		"    float4 aa;"
		"    aa.a = 1.0;"
		"    aa.r = %f;"
		"    aa.g = %f;"
		"    aa.b = %f;"
		"    return aa;"
		"}";

Works on all other models except the players in the game. What can I remove/set to disable reflection/refraction?

Share this post


Link to post
Share on other sites

If I'm not wrong, the Battlefield series follow a deferred pattern, meaning that they most likely perform the reflection in a different pass where the geometry information is passed along ( Also called GBUFFER ), so somehow you'd have to pass a flag along to the other reflection pass, and then reflect the geomtry based on if the flag is set or not. ( Not sure how difficult this would get )

 

Also, there might be mixed opinions on this, as what you're trying to accomplish is what we usually refer as hacking of some sort, I personally dont have anything against modifying game content just for the fun of it, but others might have other opinions, so be careful on what you post.

 

EDIT: If you're trying to set it to a red color, why not just then?

return float4(1,0,0,1); // r,a=1, g,b=0

-MIGI0027

Edited by Migi0027

Share this post


Link to post
Share on other sites
If this were your own game, you would have the ability to stop reflection and refraction by turning off those render passes or textures or shaders that are drawing the reflection/refraction.

But as this is being attached to anther game, the process is more complex and probably beyond the scope of the forums. Reflection and refraction can be written in many different ways. There could be many different reasons why the code does not have the intended effect uniformly. A few immediately come to mind based on common patterns of implementing reflectivity, but I am reluctant to share them because the post is described as a hack attempt rather than your own creation attempt.

If the problem that you see grayscale, that is because of a shader error. As migi wrote above, if all you are trying to do is create red, you want to set the alpha channel and the red channel to 1, the blue and green channels to 0. In your post code you have alpha at one and all three of R,G,B to %f, which is a grayscale value since all three are the same value.

My recommendation is to stop injecting your shaders into unsuspecting programs, and instead write your own code or use a tool (such as Unity's ShaderLab) to experiment with shaders in a more controlled environment.

Share this post


Link to post
Share on other sites

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

Sign in to follow this