Shader einbinden

Previous topic - Next topic

Heiko

jaja gemacht hab ich schon etwas.
und es ist ja nicht so, dass ich nix in petto hätte.
ein komplett spielbarer level meines jump and runs, komplett, fast komplett.meine playeranimation geht nicht, wegen dem .ddd problem.
(player, mein sonic is nich animiert, da ich der meinung bin ich kann ihn eh nur als 1 frame laden um ihn korrekt anzuzeigen)

und bevor jetzt jemand schreit "zeigen" "demo" "screenshot", kein problem, wenn ich die playeranimation drin hab.

hab mir schon überlegt, ob ich jedes einzelne frame seperat exportiere, und dann eben in einer schleife laufen lassen soll, aber naja, diesem weg bin ich momentan noch aus dem weg gegangen.

in einem anderen level hab ich einen see, aber das ist halt nicht wirklich ein see geworden, weil ich noch nicht weiß, wie ich den realistisch hinbekommen soll.

aber wie gesagt an erster stelle steht diese dämliche animation.

wer mag kanns sich ja anschauen, gern auch animieren, aber aufpassen, probiert mal den export mit dem hauseigenen 3dconverter.mit und ohne häkchen bei 1 frame.    http://www.glbase.de/player.rar

Kitty Hello

Das war an Heiko gedacht. Aber gilt natürlich auch an alle anderen. Klein anfangen. Mein erstes Spiel war "Bruce Lee", wo man mit einem "Pfund-Symbol (Bruce)" Geld sammeln musste ($) und einem!! Gegner ausweichen, der links-rechts lief.
Und gefääääährliche Spieße aus der Wand (#) nicht berühren durfte!

Heiko

#17
ick hab jetzt ma zwei so dateien, eine *.vert und eine *.frag

einfach mal zum testen mit dem ES benutzt, funktioniert aber nicht.

Hab einfach nen EntityLoadShader und ein EntityApplyShader genommen, nix passiert.

Hab mit einem Programm versucht nur einen einfachen Shader zu erstellen und auch beispielshader genommen, die bei dem dabei waren.

Gernot hast du vielleicht nen testshader, den ich mal probieren, wo ich weiß, der funktioniert auch?

Und an welche stelle im code muss EntityApplyShader?

Sebastian

Du könntest ja mal den Shader posten.

Heiko

#19
lieber nich, sonst lacht ihr mich noch aus, grins.

nagut, ich poste mal.

test.frag
Code (glbasic) Select

//
struct State
{
vec4 tex_coord[4];
vec3 tex_tangent[1];
vec3 tex_binormal[1];
float refracted_ior;
float incident_ior;
vec3 origin;
vec3 position;
vec3 normal;
vec3 motion;
vec2 raster;
vec3 direction;
float ray_length;
float dot_nd;
mat3 tangent_space[1];
bool backside;
float importance;
vec3 texture_du[256];
vec3 texture_dv[256];
vec4 volume_input;
vec3 light_position;
vec3 light_direction;
vec3 light_to_surface;
float light_distance;
float light_dotnl;
int light_type;
float light_spread;
float light_spread_cos;
float light_distance_limit;
};

//
// Values for the light_type parameter of light shaders
//
const int LIGHT_POINT    = 0;
const int LIGHT_SPOT     = 1;
const int LIGHT_INFINITE = 2;
const int LIGHT_PLANAR   = 3;

//
// The light iterator structure holds the return values resulting from
// evaluating a light.
//
struct Light_iterator {
vec3 point;
vec3 direction;
float distance;
float dot_nl;
vec4 contribution;
vec4 raw_contribution;
vec4 shadow;
int count;
};


//
// The following are for Depth Peeling
//
uniform bool _using_depth;
uniform sampler2DRect _depth_texture;

struct Ray {
vec3 origin;
vec3 direction;
};

vec4 illumination(float ndotl,float ndoth,float m);

float log10(float x);
vec2 log10(vec2 x);
vec3 log10(vec3 x);
vec4 log10(vec4 x);

float modf(float a,out float b);
vec2 modf(vec2 a,out vec2 b);
vec3 modf(vec3 a,out vec3 b);
vec4 modf(vec4 a,out vec4 b);

float round(float x);
vec2 round(vec2 x);
vec3 round(vec3 x);
vec4 round(vec4 x);

float saturate(float x);
vec2 saturate(vec2 x);
vec3 saturate(vec3 x);
vec4 saturate(vec4 x);

void sincos(float x,out float s,out float c);
void sincos(vec2 x,out vec2 s,out vec2 c);
void sincos(vec3 x,out vec3 s,out vec3 c);
void sincos(vec4 x,out vec4 s,out vec4 c);

mat2 transpose(mat2);
mat3 transpose(mat3);
mat4 transpose(mat4);
float determinant(mat3);
float determinant(mat4);

varying vec3 position;


//
// The following are parameters representing non-varying state variables
// referenced by the shader. These should be set by the application at runtime.
// Note that vector parameters should be provided in camera space.
//
uniform mat4 object_to_camera;
uniform mat4 camera_to_object;

//
// The following functions are generated from the MetaSL implementation of
// the shaders that are part of the compiled shader graph.
//

void Phenomenon_3_1_Phenomenon_3_main(
State state,
out vec4 msl_result)
{
{
msl_result = vec4(0.000000, 0.000000, 0.000000, 0.000000);
}
}


//
// The following method is the root function of the shader graph
//
vec4 Phenomenon_3_1_eval(State state)
{
vec4 msl_result;
Phenomenon_3_1_Phenomenon_3_main((state),msl_result);
return msl_result;
}

//
// This function is the main method of the fragment shader. It initializes the
// values in the state structure that are used by nodes in the shader graph
// and produces the final result of the shader.
//
void main()
{
if (_using_depth) {
float d = texture2DRect(_depth_texture, gl_FragCoord.xy).x;
if (gl_FragCoord.z*0.99 >= d) discard;
if (d == 0.0) discard;
}

State state;
state.position = position;
gl_FragColor = Phenomenon_3_1_eval(state);
}



test.vert
Code (glbasic) Select
varying vec3 position;

void main()
{
gl_Position = ftransform();
position = (gl_ModelViewMatrix * gl_Vertex).xyz;

gl_FrontColor = vec4(1.0);
gl_BackColor  = vec4(0.0);
}


keine ahnung was das alles so bedeutet, ist ein einfach mal so zusammengeklickter shader.
hab halt leider davon keine ahnung, was aber nicht bedeutet, dass ich aufgebe, niiiiieeeemals.

mmmmm hab grad mal geschaut, mein notebook chipsatz unterstützt wohl nur opengl 1.5, hab aber irgendwo gelesen, dass glsl shader zumindest teilweise da auch funktionieren sollen.
mmm was nun?


Sebastian

GLSL Shader benötigen mindestens OpenGL 2.0 Support.

Heiko

boah son dreck, kein wunder.
gibts denn noch andere shader, die ich derweil nutzen kann?

Sebastian

Soweit ich das beurteile nicht. GLSL ist laut Wiki auf OpenGL 2.0 beschränkt. Ob ASM Shader laufen weiss ich nicht, aber da weiss ich nichtmal, ob GLBasic die nutzen kann. Sind auch viel zu schwer zu programmieren und total veraltet.

Kitty Hello

//
// The following are for Depth Peeling
//
uniform bool _using_depth;
uniform sampler2DRect _depth_texture;

ausserdem kannst Du die so nicht übergeben. Ist aber auch egal, mit Deiner Grafikkarte. ;)