i tried understanding the premandi tut, i got it but couldnt implement it.
the most readable code i found was.
http://dev.opera.com...can-1/#comments
but his comments and explanations a vague i got stock with the castRays and castSingleRay.
i also had a long qbasic tut (i have qb on my win7).
cant find any good book about it (couldn't find any download so maybe ill buy one).
i really wrestled with this interesting subject the hole week and coldent reach full understanding.
what do i need to learn to understand it?
please can anyone help me ill give you more detailes if you need more.
cant understand raycasting
Page 1 of 110 Replies - 223 Views - Last Post: 17 February 2013 - 03:07 PM
Replies To: cant understand raycasting
#2
Re: cant understand raycasting
Posted 14 February 2013 - 09:33 PM
It's an old technique, not quite sure why you're spending so much time with it when clipping and culling techniques are the modern game development approaches. But anyway, have you read the following link?
http://www.permadi.c...cast/index.html
http://www.permadi.c...cast/index.html
#3
Re: cant understand raycasting
Posted 15 February 2013 - 05:21 AM
"i tried understanding the premandi tut, i got it but couldnt implement it."
premandi suck for beginners.
i read it and still cant implement it.
premandi suck for beginners.
i read it and still cant implement it.
#4
Re: cant understand raycasting
Posted 15 February 2013 - 08:19 AM
That is because you don't have the foundation to understand it. Secondly, not every tutorial out there is for beginners.
#5
Re: cant understand raycasting
Posted 15 February 2013 - 11:29 AM
ok what fundation do i need?
i have some programming experience,in game programming ive built a td in flashpunk and a small bullet hell game.
do i need to learn some advance math or algoritem?
i have some programming experience,in game programming ive built a td in flashpunk and a small bullet hell game.
do i need to learn some advance math or algoritem?
#6
Re: cant understand raycasting
Posted 15 February 2013 - 11:50 AM
That's a darn good question. You have not conveyed any information on what part you don't understand or can't implement. At best all we can recommend is a recursive function...
- start at the beginning
- read until you find something you don't understand.
- research what you don't understand.
- start over
- implement.
- start at the beginning
- read until you find something you don't understand.
- research what you don't understand.
- start over
- implement.
#7
Re: cant understand raycasting
Posted 15 February 2013 - 12:34 PM
ok
thats the pos of the ray on the "screen".first time of the loop it returns 160 (which is the x on the "3d screen" 160 is the middle).the screen is where the rays are renderd.
now this:
the view? the camera? the screen? whos the viewer?
i know its trigonometry but where the angle is? its probbly on the 2d screen(mini map) but what dose it have to do with the rayScreenPos?
after that its simple math and logic(not somthing i havent seen).
hers the code:
http://dev.opera.com...can-1/#comments
var rayScreenPos = (-numRays/2 + i) * stripWidth;
thats the pos of the ray on the "screen".first time of the loop it returns 160 (which is the x on the "3d screen" 160 is the middle).the screen is where the rays are renderd.
now this:
var rayViewDist = Math.sqrt(rayScreenPos*rayScreenPos + viewDist*viewDist);
the view? the camera? the screen? whos the viewer?
var rayAngle = Math.asin(rayScreenPos / rayViewDist);
i know its trigonometry but where the angle is? its probbly on the 2d screen(mini map) but what dose it have to do with the rayScreenPos?
after that its simple math and logic(not somthing i havent seen).
hers the code:
http://dev.opera.com...can-1/#comments
function castRays() {
var stripIdx = 0;
for (var i=0;i<numRays;i++) {
// where on the screen does ray go through?
var rayScreenPos = (-numRays/2 + i) * stripWidth;
/**
alert('numRays'+numRays);
alert('numRays'+numRays/2);
alert('i'+i);
alert('i'+(-numRays/2 + i));
alert('stripWidth'+stripWidth); */
//alert('rayScreenPos'+rayScreenPos);
// the distance from the viewer to the point on the screen, simply Pythagoras.
var rayViewDist = Math.sqrt(rayScreenPos*rayScreenPos + viewDist*viewDist);
//alert('rayViewDist'+rayViewDist);
// the angle of the ray, relative to the viewing direction.
// right triangle: a = sin(A) * c
var rayAngle = Math.asin(rayScreenPos / rayViewDist);
// alert('rayAngle'+rayAngle);
castSingleRay(
player.rot + rayAngle, // add the players viewing direction to get the angle in world space
stripIdx++
);
}
}
#8
Re: cant understand raycasting
Posted 17 February 2013 - 07:42 AM
no one can help me?
i have tried to understand premandi didnt work.
couldn't find any books on the subject.
searched in google posted a post in stack overflow.
found an old tut in qb
but no one explained it in a way i could understand
is there no way to learn thi thing?
i have tried to understand premandi didnt work.
couldn't find any books on the subject.
searched in google posted a post in stack overflow.
found an old tut in qb
but no one explained it in a way i could understand
is there no way to learn thi thing?
#9
Re: cant understand raycasting
Posted 17 February 2013 - 11:06 AM
#10
Re: cant understand raycasting
Posted 17 February 2013 - 02:49 PM
ok so what foundation do i need.
a name of the subject (sub subgect i guess).
or a modern book i can find on the subject.
a name of the subject (sub subgect i guess).
or a modern book i can find on the subject.
#11
Re: cant understand raycasting
Posted 17 February 2013 - 03:07 PM
Just general mathematics. To not understand ray casting point to weaknesses in trigonometry and geometry.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote









|