Jump to content
  • Advertisement
Sign in to follow this  

Understanding this model effect

This topic is 1519 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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



	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


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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!