HomeNewsFeaturesLicensingDownloadsScreenshotsFAQRoadmap Contact Us
Search:
8 Online

Community

Discussion Topics Recent Postings User Contributions General Articles Example Documentation Credits

Licensed Developer

Programmer's Manual Artists Manual Tutorials and Articles

Programming: Game Code

Game Code Overview Server Side Game Code Client Side Game Code

Programming: System

Alphabetical Function List Renderer File System Collision & Ray Casting Low Level Audio Game Audio The Console Console Variable List Multiplayer Localisation Maths Library Memory Manager Model File Formats Texture Formats

Art: Overviews

Specifications Shaders Particle Systems Lens Flares Cipher console Cipher file types Tutorials Reference

Art: Tools

Shader Designer Particle Designer 3dsmax tools Model Conversion Font Generator

Cipher Engine
Game Development Search Engine
GameDev.net
You are not signed in - [sign in] [register]

Glass Goddess

Submitted by: falcon13efx
Date Submitted: 2005-03-29 07:32:58

Screenshot

Glass Goddess

Description

Ok, you misbelievers, now at last you see proof that I have indeed integrated GPU shaders into the Cipher Core! I hope I didn't piss off the original developers or people in the forum :-) I'm just a nutter...

This program is from the Shader Designer by Typhoon labs.

This is the scripts the shader system uses. Don't like it? make a better parser... I might rewrite the tools in C# later anyways.

cipherfx
type GLSLVP
{
const {
{ "myLightPos" float 3 0 0 5 }
{ "GlassColor" float 4 0.1 0.5 0.6 0.15 }
{ "SpecularColor1" float 4 0.1 0.08 0.05 1 }
{ "SpecularColor2" float 4 0.1 0.1 0.05 1 }
{ "SpecularFactor1" float 1 2.0 }
{ "SpecularFactor2" float 1 2.0 }
}

inputs {

}
code { shaders/glass.vp }
}

type GLSLFP
{
code { shaders/glass.fp }
}

Here are the original programs:

//
// glass.vert: Vertex shader for doing a glass-like effect
//
// author: John Kessenich
//
// Copyright (c) 2002: 3Dlabs, Inc.
//

varying vec3 LightDir;
varying vec3 EyeDir;
varying vec3 Normal;

uniform vec3 myLightPos;

void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
EyeDir = -1.0 * normalize(vec3(gl_ModelViewMatrix * gl_Vertex));
LightDir = normalize(myLightPos);
gl_TexCoord[0] = gl_MultiTexCoord0;
Normal = normalize(gl_NormalMatrix * gl_Normal);
}


//
// glass.frag: Fragment shader for doing a glass-like effect
//
// author: John Kessenich
//
// Copyright (c) 2002: 3Dlabs, Inc.
//

varying vec3 LightDir;
varying vec3 EyeDir;
varying vec3 Normal;

uniform vec4 GlassColor;
uniform vec4 SpecularColor1;
uniform vec4 SpecularColor2;
uniform float SpecularFactor1;
uniform float SpecularFactor2;

void main (void)
{
vec4 color;

vec3 reflectDir = -reflect(LightDir, Normal);

//
// Uncomment this line for a cool solid look.
// Comment it out for light shining off of flat glass.
//
reflectDir = -reflectDir;

float spec = max(dot(EyeDir, reflectDir), 0.0);

//
// Compute two rings of specular effect.
//
spec = spec * spec;

//
// Basic glass color + first specular effect
//
color = GlassColor + SpecularFactor1 * spec * SpecularColor1;

//
// Second specular effect
//
spec = pow(spec, 8.0) * SpecularFactor2;
color += spec * SpecularColor2;

gl_FragColor = min(color, vec4(1.0));
}

[Recent Contributions] [Recent Screenshots]

User Contributed Comments

Mattxl 30th March, 2005 21:16
Beautiful!

Matt


ruzark 31st March, 2005 02:32
LOL :)
Nice copy paste Matt!
Edited 31st March, 2005 04:02


Mattxl 31st March, 2005 13:58
No, I typed every one of them. Hehehe.

Matt




Register and Sign In to discuss this article