| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
- Pages:
- 1
- 2
| Ray tracing problem; *changed the name when changing the subject* | |
|---|---|
| Tweet Topic Started: Apr 18 2009, 03:04 PM (886 Views) | |
| skarik | Apr 19 2009, 09:36 PM Post #16 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
And here's a link to help understand his post: Link |
| Blog|EHS | |
![]() |
|
| Ogeon | Apr 19 2009, 09:48 PM Post #17 |
|
Member
![]() ![]() ![]() ![]()
|
!!-sorry! I was away while writing this-! Sorry skarik, but this time you are wrong. My logic is fine, but my knowledge about vector and matrix is not that good (result=logic*knowledge). I just know how to solve some somple equations. Here is the code again, but with some more explanations (based on my knowledge!):
I hope this was clear enough. I think, by the way, that I have to read a little more about vectors... Edited by Ogeon, Apr 19 2009, 09:51 PM.
|
| Do you expect a signature? Forget it! | |
![]() |
|
| skarik | Apr 19 2009, 09:52 PM Post #18 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ah fiddlesticks. I guess it's time for me to make like a tree and get the hell out of here. |
| Blog|EHS | |
![]() |
|
| Ogeon | Apr 19 2009, 09:54 PM Post #19 |
|
Member
![]() ![]() ![]() ![]()
|
According to the variable n: n=-1 at creation of the tracer object, so I made no wrong there I just recycle the index. EDIT: This topic became a little messy... Edited by Ogeon, Apr 19 2009, 09:54 PM.
|
| Do you expect a signature? Forget it! | |
![]() |
|
| MysteriXYZ | Apr 19 2009, 10:00 PM Post #20 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You really should read my previous post (it's on page 1) .Anyway, here's how I would go about it. Make 2 scripts; one starts the ray tracing from the camera and calls the 2nd script, which traces recursively. Here's the first script:
And here's the recursive script:
Sorry for the lack of comments, but it was done in a hurry .
Edited by MysteriXYZ, Apr 19 2009, 10:49 PM.
|
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| Ogeon | Apr 20 2009, 04:29 PM Post #21 |
|
Member
![]() ![]() ![]() ![]()
|
Thank you MysteriXYZ! I will study your code and see if I can make this work. It was just as I thought it to be (in general), but I used the functions in the wrong way. Instead of recursive tracing where the script tells when to stop I will use a max depth to tell the ray how far to go, but it will be quite similar. Otherwise it may bounce around for ever. I will also use a difuse bounce where I make the ray leave the surface in a random direction (180 deg). May I use this method for it or will it be wrong?
EDIT: I changed the code above. It was a little wrong... better now. Edited by Ogeon, Apr 20 2009, 04:47 PM.
|
| Do you expect a signature? Forget it! | |
![]() |
|
| MysteriXYZ | Apr 21 2009, 04:22 PM Post #22 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yeah you're right, good point .Simple adding to the existing longitude & latitude won't work, if you want to keep the direction within the same half-space defined by the plane that the normal is perpendicular to. Try to visualize this in a modelling program, or using a pencil (normal) sticking out through a piece of cardboard (plane). As an example, if the plane is at a 45 degrees angle with a horizontal plane, let's say that the normal is pointing downwards (also at an angle of 45 degrees). If you add -90 degrees to the longitude of the normal, it lies in the plane and points upwards. If you then rotate the normal around the Z-axis, it will always end up at the other side of the plane. So there's only one way to do it correctly, and that's by using... (I can hear everybody shout) ...matrices .A single matrix can be used to describe the random rotation offsets, but because of the order of rotations (first rotz, then rotx and finally roty), they will be performed relative to a direction pointing to the right (positive X-axis). To see this, just take a pencil and point it to the right. Now when you rotate it around the Y-axis (rotz), it's enough to limit that angle to the [-90,+90] range to keep the pencil from pointing to the left, no matter what angle you use to rotate it around the X-axis (rotx) after that. That's great, but since you want these rotations relative to the positive Y-axis (whose rotx=roty=rotz=0), you still need to rotate the pencil -90 degrees around the Z-axis (roty). This compensates for having rotated the pencil from its default forwards direction by 90 degrees to the right at the start. Knowing all that, you should be able to make sense of the following code:
|
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| Ogeon | Apr 22 2009, 07:41 PM Post #23 |
|
Member
![]() ![]() ![]() ![]()
|
Great thanks for your help! I actually got it to work and I got an image. I have converted it to png and attached it to this post for you.The strange thing is circles of light and dark that seem to come from the center of the picture. They may dissappear later, but I don't know...
|
| Do you expect a signature? Forget it! | |
![]() |
|
| ashrat3000 | Apr 22 2009, 11:22 PM Post #24 |
|
u3d raytracer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Ooh. How long did it take to render that frame? (also, what cpu do you have) |
|
그대를 사랑해 | |
![]() |
|
| MysteriXYZ | Apr 23 2009, 11:30 AM Post #25 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
That's the awesomeness radiating from your render !Seriously though, it could be related to rounding errors. It seems to depend on the angle of the surface to the camera, as I only see this effect on the floor object. Very interesting image .
|
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| Ogeon | Apr 24 2009, 03:09 PM Post #26 |
|
Member
![]() ![]() ![]() ![]()
|
@ashrat3000: I don't really know... I was away when I rendered it, but the fps was about 1-4 (even smaller) and my cpu is a dual-core 1.9 GHz (just a little laptop). @MysteriXYZ: They look like their brightnes is a sawtooth formation or a tan() function. They are getting lighter and lighter and then suddenly drop down to dark. You can see a strange "shadow" at the block behind the wall and the same kind of shadow at the floor. The wall is allso brighter at the center. I will make some changes in the code and do an other render. |
| Do you expect a signature? Forget it! | |
![]() |
|
| ashrat3000 | Apr 25 2009, 01:29 AM Post #27 |
|
u3d raytracer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
If only we could get the color of a model's texture at a point... |
|
그대를 사랑해 | |
![]() |
|
| skarik | Apr 25 2009, 01:38 AM Post #28 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Damn. Use a DLL. Seriously. It's not that hard. |
| Blog|EHS | |
![]() |
|
| ashrat3000 | Apr 25 2009, 03:11 AM Post #29 |
|
u3d raytracer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Actually, I forgot about dlls completely. -goes off to do indirect illumination in u3d- |
|
그대를 사랑해 | |
![]() |
|
| Ogeon | Apr 25 2009, 03:27 PM Post #30 |
|
Member
![]() ![]() ![]() ![]()
|
It would be cool, but it sounds quite demanding... @skarik: I don't know if you remember it, but this is just a stupid experiment made for fun. This will not be as powerful as Yaf(a)ray or any other big render engine. I'm actually quite impressed by it's performance right now. I thought it would have to go for ever to produce such an image as the one I posted before... But this doesn't make it a bad idea.@All others: I have improved it a little and made it scan the image at first and see where it will find objects and then it will skip the parts where it doesn't find anything. I did allso invent some kind of rough anti aliasing by ofseting the pixels by +-0.5 (randomly). I will allso make it suport non glowing objects and colors. I made it render a new verson of the first image and an other with it's new functions enabled. In The first you can see those circles at the floor and the shadow at the block and the shadow appears at the secont image too. |
| Do you expect a signature? Forget it! | |
![]() |
|
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |
- Pages:
- 1
- 2





![]](http://z1.ifrm.com/static/1/pip_r.png)



.
.
I actually got it to work and I got an image. I have converted it to png and attached it to this post for you.
render.png (137.72 KB)
!
.
This will not be as powerful as Yaf(a)ray or any other big render engine. I'm actually quite impressed by it's performance right now. I thought it would have to go for ever to produce such an image as the one I posted before... But this doesn't make it a bad idea.
10:21 AM Jul 11