Lighting in an (almost) enclosed space

Previous topic - Next topic

Kitty Hello

Hm.. I have no idea. For the "ambient light", internally I use a directional light at camera point in camera looking direction. You can try a point or a directional light yourself:

Code (glbasic) Select

// This positions the players sphere (which isn't seen), and the camera thats in front of it
FUNCTION displayPlayerCamera%:player AS tPlayer
X_CAMERA player.shapeX,player.shapeY,player.shapeZ-5.0,player.shapeX,player.shapeY,player.shapeZ+500.0

X_SPOT_LT 0, RGB(255,255,255), player.shapeX,player.shapeY,player.shapeZ-555.0, 0,0,1, 360

ENDFUNCTION


Beware: Each triangle is rendered with the lighting values calculated by the vertex normals relative to the light source position. The pixels drawn on the driangle are interpolated then.
Thus, when you make a biiiig triangle and make a point light in the center, the triangle will be dark, because the corners are far away from the light and thus lightes dark. the center of the triangle is just interpolated from the corners, thus dark.

MrTAToad

Yes, the tunnel section for some reason only partially visible when textured - no idea why though.

It does seem that there might be a problem with the exporter with AC3D (or with AC3D itself) as gameSpace seems to give the correct results.

Moru

Try making smaller triangles as Gernot suggested.

MrTAToad

Assuming using the increase vertices would decrease the size of the triangles, then not much changes...



[attachment deleted by admin]

Kitty Hello

Make sure that the texture size is 2^n x 2^m even in AC3D. Texture coordinates are converted incorrectly, else.

Hemlos

#20
Right...the object is using a 33x33 map named(i assume) StartTile.png

If im not mistaking you intended to use TunnelTexture.png instead.

I replaced it in my copy...it is working(screenshot) :

[attachment deleted by admin]
Bing ChatGpt is pretty smart :O

Hemlos

Gernot, does ambient light have an origin, internally?
Bing ChatGpt is pretty smart :O

Moru

Quote from: Kitty Hello on 2009-Nov-16
For the "ambient light", internally I use a directional light at camera point in camera looking direction.

Seems origin is the camera

Hemlos

I "see" the light now, GLBasic doesnt have ambient opengl lighting...this is why we see bright and dark spots on models when we only use x_ambient_lt, because it is specular and possibly a tiny amount of diffuse.
What we need is a light option to access as many models of light as possible, for instance:
ambient light
specular light
diffuse light

This would help us produce more accurate representations of the models we see in 3d model creation programs.

This is something i found on http://www.falloutsoftware.com/tutorials/gl/gl8.htm
It is opengl code for ambient lighting.

Code (glbasic) Select

Glfloat global_ambient[] = { 0.5f, 0.5f, 0.5f, 1.0f };
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient);
Bing ChatGpt is pretty smart :O

Hemlos

Quote from: Ocean on 2009-Nov-16
Quote from: Hemlos on 2009-Nov-16
Gernot, does ambient light have an origin, internally?

http://www.glbasic.com/forum/index.php?topic=3818.msg27859#msg27859

Err yah i get the picture, everyone jumps my bones when i ask a stupid question.
As i said in my last post, we need access to the 3 light models, not just a combined single light type.

Indeed, the question was actually worded incorrectly...here is my correction..

Gernot, how can we access ambient, specualar, and diffuse lighting individually with GLBasic?
Bing ChatGpt is pretty smart :O

MrTAToad

Yes, it does appear correctly now :)

Hemlos

#26
My temporary solution for wierd x_ambientlt anomolies is this function below.
It prevents the strange rotating bright and dark spots when the camera moves, and completely surrounds the object from all directions.


Code (glbasic) Select

X_MyAmbientLight( White, 0 , 0 , 0 ) //Color,X,Y,Z


Code (glbasic) Select


FUNCTION X_MyAmbientLight: Color,X,Y,Z
X_SPOT_LT 0,Color, X+100 ,Y ,Z ,X,Y,Z,360
X_SPOT_LT 1,Color, X ,Y+100 ,Z ,X,Y,Z,360
X_SPOT_LT 2,Color, X ,Y ,Z+100 ,X,Y,Z,360
X_SPOT_LT 3,Color, X-100 ,Y ,Z ,X,Y,Z,360
X_SPOT_LT 4,Color, X ,Y-100 ,Z ,X,Y,Z,360
X_SPOT_LT 5,Color, X ,Y ,Z-100 ,X,Y,Z,360
ENDFUNCTION


Hopefully there will be a solution to acess internal spec, amb and diff lights.
Bing ChatGpt is pretty smart :O

Kitty Hello

the OpenGL wrapper can use that. I didn't enable true ambient light for one reason I can't remember since a few years  now...

Hemlos

#28
I remember why you didnt add it....it was an assumption that all the 3d programmers who were using glbasic as a "basic" thing.
Assumption was, to a new guy, the ambient light looked like crap.
But the reality of it is, ambient light adjustment is actually pretty important, to be mixed with the other 2 light styles.

What do you mean the wrapper can use that?
Can we get access to the different lights somehow(specular,ambient,diffuse)?

Feature request * 3 here(all 3 light style).  =D
Bing ChatGpt is pretty smart :O

MrTAToad

You can never go wrong with more lighting options :)

At least the problem seems to be mostly with AC3D :)