Willkommen ~Gast!
Registrieren || Einloggen || Hilfe/FAQ || Staff
Probleme mit der Registrierung im Forum? Melde dich unter registerEin Bild.
Autor Beitrag
000
02.10.2001, 23:58
Basiror



ich hab mich mal im netz umgesehen und einiges an hilfreichem material gefunden wollte nur mal fragen ober er möglich ist falls ja oder nein dann lassts mich wissen daitich meine zeit net damit verwschwende

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
001
03.10.2001, 00:47
Creeper



Also meine Überlegung wär:
Umso näher man einem point-Entity "fog" kommt desto kleiner wird 'fogstart' bis man halt voll drinne steht. Aber geht es auch dass der Nebel hinter dir ist. Dann könnte man ja volumetrischen Nebel simulieren. Oder ist volumetrischer Nebel Nebel an einem bestimmten Punkt, das geht dann natürlich leider mit der Variante ned. Aber mit Sprites und TriApi lässt sich da sicher was nettes basteln. Ich probier das mal mit meinen Partikeln ;)

--

Head Coder:Sudden-Impact

Listen to CKY you fuCKYrs http://www.ckymusic.com

zum Seitenanfang zum Seitenende Profil || Suche
002
03.10.2001, 00:50
Basiror



oh man
volumetric fog ist nebel der zb auf dem boden liegt wie zb auf nem friedhof mit düsterer atmossphäre

das hat nix mit dem zu tun was du da vorschlägst

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
003
03.10.2001, 01:57
Creeper



Also dann gehts afaik nicht, höchstens mit ein paar Mapping-Tricks!

--

Head Coder:Sudden-Impact

Listen to CKY you fuCKYrs http://www.ckymusic.com

zum Seitenanfang zum Seitenende Profil || Suche
004
03.10.2001, 09:31
Basiror



oder mit ogl rendering tricks

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
005
03.10.2001, 15:23
Prefect



Also so wirklich genialer volumetric fog wird mit dreidimensionalen Texturen kommen... aber nicht mehr bei Half-Life ;)
Und - wie ich fürchte - auch nicht mit OpenGL. Im Vergleich zu DirectX entwickelt sich OpenGL leider _viel_ zu langsam weiter. Inzwischen kann man ja sogar Direct3D-Programme schreiben ohne durchzudrehen.

cu,
Prefect

--

Widelands - Gemütliche Aufbaustrategie, Free Software
Noch ein Blog - Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.

zum Seitenanfang zum Seitenende Profil || Suche
006
03.10.2001, 16:12
Basiror



i should take some time to test it

/*
* Copyright 2000 Sean Barrett
*
* feel free to copy, alter, modify, etc., but don't
* redistribute in source form without this notice.
*/

/*
* this is the fog-rendering part of the codebase
* that was used to develop the volumetric fog code.
* hopefully most of the references to things not in
* the code should be self explanatory.
*
* requires 3 bits of stencil
*
* it was tested on an NVIDIA TNT
*/

void draw_polygon(int num_verts, vec3f *verts)
{
int i;
glBegin(GL_POLYGON);
for (i=0; i < num_verts; ++i)
glVertex3fv(&verts[i].x);
glEnd();
}

void draw_convex_object(int num_faces, int *num_verts, vec3f **verts)
{
int i;
for (i=0; i < num_faces; ++i)
draw_polygon(num_verts[i], verts[i]);
}

static GLuint exp_fog_texture;

void setup_fog_blending_from_plane(vec4f *p, vec4f *color, vec3f *eye)
{
// fog computation is as follows:

// distance from point P to plane <N,d> in the "direction of the eye"
// is the distance from point to eye times the ratio of the distance
// of the point from the plane to the plane to the eye. approximate
// the distance of point to eye with the z depth of the point, so compute:

// dist = ||P-E|| (1 + d/((P-E).N))
// d is always negative
// if P.N goes negative, point is on wrong side of plane, so we don't care about it
//
// let s = ||P-E|| approximated as z depth: (P-E).eyedir
// let t = -(P.N)/d
//
// the interesting range of s is 0..MAX_VIEW_DIST
// the interesting range of t' is 0..ENORMOUS (as d gets small)
// but the computation on t (1+1/t) means we don't care about
// the value of t once it gets really big.
//
// so we use a texture:
// F(s,t) = s * (1 - 1/t)
//
// with s = 0..1 for z depth = 0..MAX_VIEW_DIST (the depth at which fog maxes out)
// and t = 0..1 for (P.N)/d = 0..-32

vec4f components;
float scale;
float e;

#define MAX_DIST (MAX_VIEW_DIST * GRID_SIZE)
#define MAX_FOG_DIST 16

scale = 1.0 / MAX_DIST;

#if 0
// hmm, eye linear does weird modelview inversions
// which the red book doesn't explain any better than
// the reference guide.
//
// i'm guessing I should just use the components set in the #else
// but I haven't gotten around to trying it
components.x = 0;
components.y = 0;
components.z = scale;
components.w = 0;

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, &components.x);
#else
components.x = eye->x * scale;
components.y = eye->y * scale;
components.z = eye->z * scale;
components.w = -vec3f_dot(eye, &camera_loc) * scale;
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, &components.x);
#endif

e = vec3f_dot((vec3f *) p, &camera_loc) + p->w;

#define T_SCALE 8.0
if (e != 0)
scale = 1.0 / -e / T_SCALE;
else
scale = 0;

components.x = p->x * scale;
components.y = p->y * scale;
components.z = p->z * scale;
components.w = -vec3f_dot((vec3f *) p, &camera_loc) * scale;

// this should be eye linear too so you don't have to
// change it after every object
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, &components.x);

components.x = 0;
components.y = 0;
components.z = 0;
components.w = 1;

glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_Q, GL_OBJECT_PLANE, &components.x);

glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
//glEnable(GL_TEXTURE_GEN_Q); // this doesn't seem to work :(
// rely on leaving Q at 1 everywhere else

// enable pre-multiplied alpha blending, to allow "overbright" fog (halos)
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glColor4fv(&color->x);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, exp_fog_texture);
}

// should test to see what sizes work best (want to avoid
// having repeated values in the data which cause the bilerp
// to produce a constant), less of an issue with 2d though
#define FOG_S_SIZE 32
#define FOG_T_SIZE 32
static unsigned char texdata[FOG_S_SIZE][FOG_T_SIZE];
void init_fog_tex(void)
{
int i,j;
glGenTextures(1, &exp_fog_texture);
for (j=0; j < FOG_T_SIZE; ++ j) {
float t = (float) (j+0.5) / FOG_T_SIZE;
for (i=0; i < FOG_S_SIZE; ++i) {
float s = (float) i / FOG_S_SIZE;
float dist;
float fog;

// dist = || P || * (1 + d/(P.N))
// s ~= || P || / MAX_DIST
// t = -(P.N)/d / T_SCALE

dist = s * MAX_DIST * (1 - 1.0/(t*T_SCALE));
if (dist < 0) dist = 0;

#if 0
fog = exp(-0.5 * dist / MAX_FOG_DIST);
#else
fog = 1 - dist / MAX_FOG_DIST;
#endif
if (fog < 0) fog = 0;
if (fog > 1) fog = 1;

texdata[j][i] = 255 - (int) 255.9*fog;
}
}
glBindTexture(GL_TEXTURE_2D, exp_fog_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY8, FOG_S_SIZE, FOG_T_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, texdata);
}

void setup_fog_blending_from_poly(int num_verts, vec3f *verts, vec4f *color, vec3f *eye)
{
vec4f p;
compute_plane_equation(&p, verts+0, verts+1, verts+2);

setup_fog_blending_from_plane(&p, color, eye);
}

void disable_fog_blending(void)
{
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_Q);
}

void draw_convex_fog(int num_faces, int *num_verts, vec3f **verts, vec4f *fog_color)
{
static int init_tex=FALSE;
int x0,y0,x1,y1; // quick-n-dirty worldspace bounds to minimize drawing
int i;
vec3f eye;

if (init_tex == FALSE) {
init_tex = TRUE;
init_fog_tex();
}

// get vector parallel to eye
{
GLdouble matrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, matrix);
eye.x = -matrix[2];
eye.y = -matrix[6];
eye.z = -matrix[10];
vec3f_normeq(&eye);
}

do_fog = TRUE; // disable glColor calls, glBindTexture calls in engine

compute_fog_bounds(num_faces, num_verts, verts, &x0,&y0,&x1,&y1);

// enable important stuff that's already enabled but to be clear

glEnable(GL_CULL_FACE);

// assume stencil buffer is at 0 everywhere
// so first lets stencil in the backside of the fog

glDisable(GL_TEXTURE_2D);
glFrontFace(GL_CCW); // backside of fog
glEnable(GL_STENCIL_TEST); // want to output stencil values
glStencilFunc(GL_ALWAYS, 2, 0); // don't stencil test
glStencilOp(GL_KEEP, GL_REPLACE, GL_INCR); // if pixel is in front of backface, set to 2
// if pixel is behind backface, set to 1
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);

draw_convex_object(num_faces, num_verts, verts);

// now iterate through front faces
for (i=0; i < num_faces; ++i) {
// @TODO: major speed up
// if this polygon is backfacing, "continue;"
// the math in setup_fog_blending_from_poly computes the needed data
glFrontFace(GL_CW);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 4, 0); // for GL_REPLACE below
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); // test if pixel is behind front face
glStencilMask(0x4); // if front face is hidden, just 0 stencil buffer
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);
draw_polygon(num_verts[i], verts[i]);
glStencilOp(GL_KEEP, GL_ZERO, GL_KEEP); // test if pixel is behind front face
glStencilMask(0xff); // if front face is hidden, just 0 stencil buffer
draw_polygon(num_verts[i], verts[i]);

// now we haze things inside the fog
glStencilFunc(GL_EQUAL, 6, 0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
setup_fog_blending_from_poly(num_verts[i], verts[i], fog_color, &eye);
render_bounded_scene(x0,y0,x1,y1);
// render everything inside the fog; only pixels behind this polygon
// will be fogged, and only the pass that actually produced the current
// value in the z buffer; if there's more than one due to, e.g.
// interpenetrating polygons, we use the stencil buffer to
// prevent it from being fogged more than once

// ok, now draw the backfaces, if a backface is visible (ztest) we need to
// fog at that depth
glFrontFace(GL_CCW);
glStencilFunc(GL_EQUAL, 5, 0xff); // did it get incremented, indicating back was visible
draw_convex_object(num_faces, num_verts, verts); // should display list this?

// Handling transparent objects is probably really hard :(
// probably wait 'til after this loop to even draw them at all,
// draw them with zset, and doing a full loop over the fog faces for each
// (have to sort the transparent faces w.r.t one another). ugh, not
// perfect though when a transparent object goes out a backface

disable_fog_blending();
}

// now draw all the pixels which are in front of back faces but for
// which no front face is in front of them
{
vec4f p;
p.x = eye.x;
p.y = eye.y;
p.z = eye.z;
p.w = -vec3f_dot(&eye, &camera_loc)-0.1; // 0.1 should be near plane distance
setup_fog_blending_from_plane(&p, fog_color, &eye);
}

// this is a cut&paste of the code in the loop above, without the '4+'
glFrontFace(GL_CW);
glStencilFunc(GL_EQUAL, 2, 0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
render_bounded_scene(x0,y0,x1,y1);

glFrontFace(GL_CCW);
glStencilFunc(GL_EQUAL, 1, 0xff); // or did it get incremented, indicating back was visible
glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); // this is unnecessary, but clear stencil explicitly
draw_convex_object(num_faces, num_verts, verts);
disable_fog_blending();

// reset default state
glFrontFace(GL_CW);
glDepthMask(GL_TRUE);
glDisable(GL_STENCIL_TEST);
glEnable(GL_TEXTURE_2D);

do_fog = FALSE;
}

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
007
03.10.2001, 19:02
Mazze



Zitat:
Prefect postete
wie ich fürchte

Wieso fürchtest du das?

--

BattleTech-MOD:
http://bthl.unitedgaming.net/

zum Seitenanfang zum Seitenende Profil || Suche
008
04.10.2001, 18:59
Creeper



OpenGl wurde afaik schon lange ned mehr geupdatet!

--

Head Coder:Sudden-Impact

Listen to CKY you fuCKYrs http://www.ckymusic.com

zum Seitenanfang zum Seitenende Profil || Suche
009
04.10.2001, 19:17
Prefect



Zitat:

Wieso fürchtest du das?

Vielleicht ist dir ja noch nicht aufgefallen, daß Direct3D die einzige Alternative ist. Und vielleicht ist dir noch nicht aufgefallen, daß DirectX von Microsoft ist.

cu,
Prefect

--

Widelands - Gemütliche Aufbaustrategie, Free Software
Noch ein Blog - Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.

zum Seitenanfang zum Seitenende Profil || Suche
010
04.10.2001, 21:17
Mazze



Ja leck mich am Arsch!
Was soll den das!
Das ist mit 100% Sicherheit der größte Scheiß den du je in dieses Forum geschrieben hast!
Mich kotzt es langsam an!
Jetzt meckert ihr schon rum, dass MS besser ist als OpenGL!
Sowas glaubt man gar nicht!

Und das Linux.....ohhh......Linux.....ich hohl mir gleich einen runter so geil ist das Gehabe kann ich auch überhaupt nicht leiden!

So. Das musste mal gesagt werden!

--

BattleTech-MOD:
http://bthl.unitedgaming.net/

zum Seitenanfang zum Seitenende Profil || Suche
011
04.10.2001, 21:46
Archangel



OMFG

ok, du kannst ja ms uuunheimlich toll finden, aber deine reaktion (leck mich am arsch) is das letzte

--

Mar 01 01:10:13 <voice> jo
Mar 01 01:10:40 <voice> bis dann ^^
Mar 01 01:11:20 <Archangel> jo
**** ENDING LOGGING AT Tue Mar 1 01:58:13 2005


Dieser Beitrag wurde am 04.10.2001 um 21:47 von Archangel bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
012
04.10.2001, 21:48
Raptor-tf



"OMFG"
Dem ist nichts hinzuzufügen...

--

cya Rap

Rettet die Welt:
Bomb Snut

zum Seitenanfang zum Seitenende Profil || Suche
013
04.10.2001, 22:57
Creeper



Wisst ihr dass OGL schon seit Jahren Shader drinne hat und DX erst ab Version 8 ??

--

Head Coder:Sudden-Impact

Listen to CKY you fuCKYrs http://www.ckymusic.com

zum Seitenanfang zum Seitenende Profil || Suche
014
04.10.2001, 23:37
Basiror



wisst ihr das die unrealwarfare engine hauptsächlich wegen dx8 so geil aussieht???

und ogl zulangsam weiterentwickelt wird was sich schlecht für linux auswirken wird
und das ms extra viel mühe in dx steckt um somit linux wieder etwas vom spiele mark zu verdrängen??

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
015
04.10.2001, 23:47
Hanfling



äh OpenGL rulez und die meisten sachen die masosoft so großartig ankünidigt in direkt x kann opengl schon immer...

@basiror warum sieht die bitteschön wegen dx8 so geil aus?

--

Nun ist deine Zeit gekommen sprach der Tod, stolperte und brach sich das Genick. :o

zum Seitenanfang zum Seitenende Profil || Suche
016
05.10.2001, 00:23
Rockefeller



Also es ist wohl richtig, dass DX sich schneller an neue Techniken anpasst, aber kaum ein Spiel benutzt großartig Techiken, die nicht auch mit OGL gehen würden und OGL ist schneller als DX.
Aber ich sehe OGL auch langsam sterben, denn je mehr neue Funktionen direkt auf die GPU gelegt werden, desto schlechter stehts um ein nicht ausreichend gewartetes Interface.

--

zum Seitenanfang zum Seitenende Profil || Suche
017
05.10.2001, 14:36
thinktank



entschuldigung, aber was sind 3d-Texturen ? Ich kann mir das irgendwie ned vorstellen ;) .

--

zum Seitenanfang zum Seitenende Profil || Suche
018
05.10.2001, 15:15
Basiror



3d texturen ist wahrscheinlich ein rechtschreibfehler

--

Basiror's Labs Game-Development page

Hifle in form von Tutorials, Artikeln und anderem wird dankbar angenommen

zum Seitenanfang zum Seitenende Profil || Suche
019
05.10.2001, 15:23
[GOD]ShadowLord



nö,geht,is so'ne art bumpmapping.
ps: OGL RULEZ aber DX is auch ok,D3D sux(zu lahm)

--

they come in peace - and go in pieces

zum Seitenanfang zum Seitenende Profil || Suche
020
05.10.2001, 17:26
Another1



quote: D3D sux(zu lahm) // (hab ich mehrmals gehört)

was ich dazu sage: nunja, das hört sich so an als wenn ihr durch viel erfahrung festgestellt habt das OpenGL natürlich vieeel schneller is als DX und man DX auf jeden fall vermeiden sollte (natürlich ins besondere D3D) :P
Nichts gegen euch (alle, die sich angesprochen fühlen sollten), aber ich fälle mein Urteil erst wenn ich mir !selbst! eine Meinung darüber gemacht habe, oder wenigstens ein wenig von der Materie verstehe

ich sach mal man sollte nich wahllos alles nachplappern was man irgendwo gelesen hat :P

und 3d texturen: sicher geht das, das könnte z.b. bedeuten das texturen nen alpha channel haben, und schwupps sind sie 3 dimensional, oder sie haben wirklich ne tiefe, die man durch licht dann sieht (e.g.: bumb mapping)
es gibt natürlich auch 1D texturen .. nur weil man sich 3D Texturen etwas schwieriger vorstellen kann, heißt es nich, das es sie nicht gibt!

--

Another1

...relaxing..atm =)
... und Schweiz suckt!

zum Seitenanfang zum Seitenende Profil || Suche
021
05.10.2001, 19:22
Mazze



@Another1:
Eeeeendlich!
Juhu!
Ich fühle mich bestätigt =)

--

BattleTech-MOD:
http://bthl.unitedgaming.net/

zum Seitenanfang zum Seitenende Profil || Suche
022
05.10.2001, 22:22
Lephro



Ehhhm nur zur Korrektur !

Zitat :

es gibt natürlich auch 1D texturen .. nur weil man sich 3D Texturen etwas schwieriger vorstellen kann, heißt es nich, das es sie nicht gibt!

Es gibt keine 1D Texuren ! Wenn es die gäbe wie wllst du eine Textur darstellen die nur eine Länge hat aber breite == 0 ? Deswegen 2D Texturen !

Ich weiss ,dass dieser Thread sinloss ist aber´naja was solls

THX 2 ALL

--

zum Seitenanfang zum Seitenende Profil || Suche
023
06.10.2001, 12:27
Another1



genau das, sie haben nur eine länge, wie ein streifen ... ich zitiere einfach mal aus der <gl\gl.h>
Quellcode:
#define GL_TEXTURE_1D                     0x0DE0
#define GL_TEXTURE_2D                     0x0DE1

bis dann
[edit]
ach noch was, ab wann man eine Textur X-Dimensional nennt ist einem eigentlich auch selbst überlassen, denn meiner Meinung nach is z.B. eine animierte Textur (meist eine zeitliche Abfolge von 2D Texturen) auch 3D, da sie sich ja mit der Zeit "verändert". ... naja, man kann es sehen wie man will.

--

Another1

...relaxing..atm =)
... und Schweiz suckt!


Dieser Beitrag wurde am 06.10.2001 um 12:28 von Another1 bearbeitet.
zum Seitenanfang zum Seitenende Profil || Suche
024
06.10.2001, 16:36
anothergb02



BAD BUDA BIDA:

So hier ist mal nen Beispiel warum ihr net D3D verwenden sollt !
- altes Worldcraft !

--

Being in john Malkovich
.....

zum Seitenanfang zum Seitenende Profil || Suche