Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / set vertexdata normals

Author
Message
adr
20
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 6th May 2005 09:43
I've tried recreating an old program of mine using the new vertex tweaking commands which 5.8 provides.

Pretty much everything is working, aside from generating the face normals. When viewing the mesh, there's no shading or lighting (indicative of a lack of normals). I can't decide if it's my code, or the "SET VERTEXDATA NORMAL" command. I've got the code spitting out the actual vertex normals and they look genuine (0.543534,0,0.32124 for example) which leads me to believe it's something else (other than the algorithm)....

Here's teh codez. For your information, getVertexID takes a vertex number for a tile (0,5) and a reference (x,y) and produces the actual vertex number.... This function works, before you ask I'm only doing it on half the faces for simplicity's sake... (1-3 only, not 4-6).

Point 1 is opposite the hypotenuese... that means that the direction vectors are calculate by doing 2-1 and 3-1.




Err - hope someone can make sense of this. Or better yet has come across this...

Me? With my reputation?
adr
20
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 7th May 2005 19:52
no-one?

*bump*

I'll continue to stab at the commands today, but I'm not entirely sure what else I can do.

Me? With my reputation?
Nicholas Thompson
19
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 7th May 2005 20:53
Quote: "(0.543534,0,0.32124 for example)"


Is that just a random number or is that a genuine example? If so - why is the Y value 0? That means you normal isn't poining up or down, its just on the XZ plane.

My Website:
BealziBob
19
Years of Service
User Offline
Joined: 9th Jul 2004
Location: The Grim North (UK)
Posted: 7th May 2005 22:31 Edited at: 7th May 2005 22:35
Adr's example isn't necessarily wrong, it all depends on the orientation of the poly. This example could be the side of a cube! That's assuming normals use absolute co-ordinates, which I'm sure they do.

adr
20
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 8th May 2005 00:31
Nicholas Thompson > it was just a random set of numbers I typed in. As it's a terrain, 99.9% of the time I'd expect there to be a vertical element to a face normal.

I'm going through a 10x10 grid, each with 2 faces, so that's 200 normals - and not one seems to create the illusion of lighting. All the normals echo'd out seem to be different (well, not 0,0,0) but there's no "lighting" to the mesh.

[20 minutes later]

I've just modified the script to draw lines (using line and object screen x/y) showing the normals... even if there is an algorithmic problem with my face normal generation, the normals are *present* and *not* 0,0,0.



Me? With my reputation?
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 8th May 2005 01:27
are you sure you have lighting enabled for the object and that there is a light source? also check out the normalize command it might have something to do with it.

http://www.larinar.tk
AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb.
adr
20
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 8th May 2005 22:20
after having set all the normals (using set vertexdata normals) To random values, I converted the resulting object to a mesh, and in turn to a memblock. Reading off any normal (using memblock float) returned in "0".

Something is wrong.

wtf.

Me? With my reputation?
Avan Madisen
21
Years of Service
User Offline
Joined: 12th Sep 2002
Location: The Castle Anthrax
Posted: 9th May 2005 08:00
I've found this problem recently, the problem is with the FVF format and the vertex manipulation commands, they only seem to work with objects using the default FVF used by the DBP primitive objects, I think it's 274. Try changing the normals on a primitive and you should get results.

I don't suffer from insanity - I enjoy every minute of it!
Current Project:
Lemmings Remake
adr
20
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 9th May 2005 20:42
@Avan: Thankyou! Hooray ... well, the downside is that I needed vertex alpha'ing for this project to work, but at least I know I'm not going insane.

@TGC: jesus suffering f**k guys. Can we expect this to be fixed in the next release?

Me? With my reputation?
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 15th Jul 2005 20:54
@adr Do you mind if I use a slightly modified (to fit my code) version of that normal calculating code? I usually just cheat and use EXRotate but I want to post some code for making a matrix to an object (with lighting) and heightmap image to object (with lighting) code that anyone with just basic DBP can use.

Firesea
21
Years of Service
User Offline
Joined: 7th Apr 2003
Location:
Posted: 27th Jul 2005 23:47
well, the downside is that I needed vertex alpha'ing for this project to work, but at least I know I'm not going insane.

What is vertex alpha'ing and did this work to correct the normals issue with advanced terrain ?

Login to post a reply

Server time is: 2024-05-01 11:17:28
Your offset time is: 2024-05-01 11:17:28