Search found 14 matches

by damoos
January 6th, 2020, 2:28 am
Forum: Everything
Topic: Z divide fundemental question
Replies: 12
Views: 6111

Re: Z divide fundemental question

ok, I'm still a bit confused. Just to be clear, my 10x10 is the frustum size, not the physical screen size. Just to insure we are are on the same page here, we still need to convert to the (in my case ) 640 by 480 physical screen. I'm actually still confused here. Let me ignore actual coordinates, a...
by damoos
January 5th, 2020, 2:53 am
Forum: Everything
Topic: Z divide fundemental question
Replies: 12
Views: 6111

Re: Z divide fundemental question

Oh, I do know how to use the debugger. Its just finding the right places to watch is difficult in the version of the demo that has this portion added. Its obscured (at least for me) by the shader system, and the fact that the geometry is loaded externally, rather than a simple in code defined cube f...
by damoos
January 5th, 2020, 2:50 am
Forum: Everything
Topic: Z divide fundemental question
Replies: 12
Views: 6111

Re: Z divide fundemental question

First off, sorry I didn't notice your lengthy response to the prior post. Slipped through the cracks in my haphazard world! Thanks for going to the effort! Bad form for me to not have noticed. Apologies. Also, I actually do consider aspect ration in my code. Just didn't here for simplicity. Ok, I wa...
by damoos
January 4th, 2020, 11:36 pm
Forum: Everything
Topic: Z divide fundemental question
Replies: 12
Views: 6111

Z divide fundemental question

I've asked this before, and usually get told to post my code. This is not a code problem, but a fundamental concept question. My code does exactly what I expect. Lets say my view frustum is 10 units wide, 10 units high, and ten units deep. Lets not do any FOV consideration, so near plane is 1; Lets ...
by damoos
November 28th, 2019, 4:46 am
Forum: Everything
Topic: how best to recalc surface normals
Replies: 3
Views: 1852

Re: how best to recalc surface normals

Ok, actually I am already using your first example's method in my code (all transformations are done to the same start point), so yeah, it was silly to imagine accumulated error.

As for translation, don't I avoid that by having the normal's w component be zero?
by damoos
November 27th, 2019, 10:36 pm
Forum: Everything
Topic: how best to recalc surface normals
Replies: 3
Views: 1852

how best to recalc surface normals

Is it common to apply the same rotations and translations to you surface normals as the vertices, or is it better to calculate new ones AFTER said transformations? I currently do the latter, because I'm concerned that floating point rounding errors will, over time, cause the normals to no longer be ...
by damoos
November 27th, 2019, 2:20 am
Forum: Everything
Topic: W divide confusion
Replies: 2
Views: 1374

W divide confusion

Ok, I've asked this poorly before, but I'll give it another stab. Here is what I think to be correct: After the projection transform, my x and y have been scaled to NDC space, where coordinates on the view plane are from -1 to 1 in x and y Further, z coordinates are scaled to where , after a w divid...
by damoos
November 17th, 2019, 6:41 am
Forum: Everything
Topic: Yet ANOTHER projection question!
Replies: 0
Views: 15093

Yet ANOTHER projection question!

So I have the projection matrix up and running. Its in the standard form: [2n/w] [ 0.0 ] [0.0] [0.0] [ 0.0 ] [2n/h ] [0.0] [0.0] [ 0.0 ] [ 0.0 ] [ f/f-n] [ 1 ] [ 0.0 ] [ 0.0 ] [-nf/f-n] [0] So what I don't understand is this. X and Y will be scaled to -1 to 1 coordinates, as they should. Z will be s...
by damoos
November 17th, 2019, 4:23 am
Forum: Everything
Topic: Help with projection matrix (again :) )
Replies: 3
Views: 1918

Re: Help with projection matrix (again :) )

Here is a dumb question. As I understand, the near plane z is defined completely by the FOV. In my example, with a FOV of 100°, I got a distance of 1/tan(50) = .84 I am getting it correct to use that .84 as my 'n' variable, yes? Thus, objects at z=0 in viewspace would get translated -.84 by the proj...
by damoos
November 16th, 2019, 11:03 pm
Forum: Everything
Topic: Help with projection matrix (again :) )
Replies: 3
Views: 1918

Re: Help with projection matrix (again :) )

Ok, update: if I make sure my viewspace origin is at 0, it works. So, in my example, it would go from -15 to 15. Math works out now. What got me confused, is that my books seem to have a translation to a zero centred viewport as part of the initial, un-reduced equation. In actual code, I would have ...