Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Other - [HLSL] Constant Colour Shader

Chris Tate
DBPro Master
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 23rd Jul 2015 15:28
DBPRO features a COLOR OBJECT, which provides the easiest way to make an object or limb render in a single colour. The problem with this approach is that in most cases when you need an object to be a certain colour, the object is instead displayed as a desaturated fade of the colour you specify.

One way to overcome this problem is by using SET OBJECT EMISSIVE to enhance the colour, and SET OBJECT FOG to prevent coloured objects from being affected by fog can help make the colour stand out. The problem with this solution is that all of these parameters are disregarded once you introduce shaders into your game or application to enhance the look of your scene. Another problem is that you may not want to have to deal with such parameters whatsoever.

This sample shader demonstrates how you can get started displaying your objects in rich colour uneffected by fog, ambience or other environmental factors. The object simply remains coloured by the tint you specify. Use the FillColor constant in the shader to specify colour you want to use. Shader constants can be adjusted in code by using SET EFFECT CONSTANT VECTOR. All objects using the same effect number will be displayed by the same colour that is assigned to that shader.

Login to post a reply

Server time is: 2024-02-21 06:17:14
Your offset time is: 2024-02-21 06:17:14