Orange Shader         Your first and easiest shader
Print

Description

This is the first and easiest shader. It is not very useful, except for a tutorial purpose. It will just paint your object in a predefined color (here: orange).
Orange_shader.jpg

Usage

Just give the material shader/orange to your object.

orangeshader.cg

// -----------------------------------------------------------
 // Very simple shader
 // The object is colored in orange
 // -----------------------------------------------------------
 
 float4 main_fp(in float3 TexelPos : TEXCOORD0) : COLOR
 {
     float4 oColor;
 
     oColor.r = 1.0;
     oColor.g = 0.8;
     oColor.b = 0.0;
     oColor.a = 0.0;
 
     return oColor;
 }

orangeshader.material

 

Note: See http://www.ogre3d.org/docs/manual/manual_18.html for a list of profiles

fragment_program shader/orangeFP cg
 {
     source orangeshader.cg
     entry_point main_fp
     profiles ps_1_1 arbfp1
 }
 
 material shader/orange
 {
     technique
     {
         pass
         {
             fragment_program_ref shader/orangeFP
             {
             }
             texture_unit
             {
             }
         }
     }
 }

 


Alias: Orange_Shader


Contributors to this page: jacmoe111451 points  and Ramy .
Page last modified on Monday 28 of June, 2010 18:06:03 GMT by jacmoe111451 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.