Weird normal calculation
Weird normal calculation
Weird normal calculation
Weird normal calculation
Weird normal calculation
Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation
Weird normal calculation Weird normal calculation
Weird normal calculation
Go Back  Xtreme Visual Basic Talk > > > > Weird normal calculation


Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2006, 06:13 PM
ShadowWolf ShadowWolf is offline
Centurion
 
Join Date: Jan 2006
Location: Finland
Posts: 114
Question Weird normal calculation


Thanks to ardman, frisker and Moohasha for the help with getting the lights working. But now there is a new problem which I sort of know how to solve but it seems to be alot of work for such a simple thing (as I see it now) so I want to make sure before I proceed.

1) Look at the 2 pictures below. I think it should be pretty obvious what's wrong there. In the picture where the light is drawn correctly the light direction is Vector3(0, -1, 0), however, in the other picture the direction is Vector3(-1, -1, 0). The light is straight above the room at all times. What I have seen so far, with an effect file I could get a pixel shader to do somekind of normaltranslation for me, obviously rotating it in the correct direction automatically, obviously removing that strange.... gradient. Is there an easier way to accieve this fix (looking at an fx file is enough to make me want to leave this)?

2) Thinking about the future of this test, an effect file would obviously be the right thing to use because that seems to be the only way to draw shadows and reflections? Correct?
Attached Images
File Type: png light01.png (205.8 KB, 16 views)
File Type: png light02.png (255.4 KB, 14 views)
Reply With Quote
  #2  
Old 06-22-2006, 01:00 AM
ardman ardman is offline
Contributor
 
Join Date: Jan 2002
Posts: 126
Default

Any chance we can see the code for your FX file and how your implementing it in your code?
__________________
Cheers
Reply With Quote
  #3  
Old 06-22-2006, 03:38 AM
ShadowWolf ShadowWolf is offline
Centurion
 
Join Date: Jan 2006
Location: Finland
Posts: 114
Default

Quote:
Originally Posted by ardman
Any chance we can see the code for your FX file and how your implementing it in your code?
There is no fx file feel free to suggest what it might look like

Last edited by ShadowWolf; 06-22-2006 at 03:52 AM.
Reply With Quote
  #4  
Old 06-22-2006, 09:28 AM
ShadowWolf ShadowWolf is offline
Centurion
 
Join Date: Jan 2006
Location: Finland
Posts: 114
Default

Actually, nevermind this, or if you are certain of whats wrong then please tell me but atm. I think I know where the problem is. The problem with lights still remain:

point and spot lights do not work at all unless I create the device using SoftwareVertexProcessing. With HardwareVertexProcessing only the directional light works. I have Radeon 9800 Pro, it supports DX9 and all it's features so I do not know why this happens. Could be a programming error in the original dx9 dlls, the ones we use for development that is because normal dx9 games work without ANY problems. This problem could be hardware related, and I will not try to solve this issue now because of the big steps I must now take in my life. Things are chaning and programming is on priority 2 for now on until things calm down again.
Reply With Quote
  #5  
Old 07-10-2006, 08:32 AM
RcSepp RcSepp is offline
Regular
 
Join Date: Oct 2004
Posts: 55
Default

Just one idea (don't know if I understood your problem right):
If you took the normals from arrays or anything like that, you maybe could have mixed up which normal preserves to which vertex on a triangle.
I had that problem just a minute ago and that helped
Reply With Quote
  #6  
Old 07-21-2006, 05:12 AM
ShadowWolf ShadowWolf is offline
Centurion
 
Join Date: Jan 2006
Location: Finland
Posts: 114
Default

Quote:
Originally Posted by RcSepp
Just one idea (don't know if I understood your problem right):
If you took the normals from arrays or anything like that, you maybe could have mixed up which normal preserves to which vertex on a triangle.
I had that problem just a minute ago and that helped
Thanks for the idea. AFAIK there is no array used for this because I do the room "construction" like this:

1) Load room tiles from a file
2) Build (pre-calculate) matrixes for all meshes using the info in the tile map
3) Calculate the normal (using CalculateNormals) of each mesh and store it in the mesh itself

I think an array would make my room look like the 2nd image all the time but as long as the light stays directly above the room it looks like it does in the 1st image. Once I tilt, rotate or pan the light it goes nuts.

As you can see, I move the meshes into their correct places before I calculate the normals, so I guess that lines out the idea of the normals beeing calculated while the mesh is still at 0,0,0 (which would make them look pretty much like the ones in image 2). Oh and, even if the normals were calculated at 0,0,0 , these lights are dynamical right? Atleast the point light is.

I don't think the 3d editor I'm using (anim8or (www.anim8or.com)) is able to calculate normals or save them into a 3ds file (which should be able to store normals, right?). If I could do that I could try that just in case the built in function is buggy or I'm using it incorrectly.
Reply With Quote
  #7  
Old 08-23-2006, 01:39 AM
RcSepp RcSepp is offline
Regular
 
Join Date: Oct 2004
Posts: 55
Default

Event if the normal calculation isn't buggy, I know it wouldn't be the most professional way, but why not try to go through all normals after calculation with a self made function. It shouldn't take long because it's pure mathematik and sometimes this methode gets me to find a little bug in my code (for example a missing - ).
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Weird normal calculation
Weird normal calculation
Weird normal calculation Weird normal calculation
Weird normal calculation
Weird normal calculation
Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation Weird normal calculation
Weird normal calculation
Weird normal calculation
 
Weird normal calculation
Weird normal calculation
 
-->