| 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: |
| Reflections | |
|---|---|
| Tweet Topic Started: Sep 14 2007, 08:26 AM (755 Views) | |
| Zedman3d | Sep 14 2007, 08:26 AM Post #1 |
![]()
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Could someone make me an example or something (gm6) because my code simply wont work.
|
| |
![]() |
|
| MysteriXYZ | Sep 14 2007, 10:10 AM Post #2 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
These are some mistakes in your code: 1) "Island", the room value you pass to RenderToCubeTexture(...) is probably the ID of a Game Maker room, right? That should be the index of an U3D room that has to be rendered. Usually this is 0 (which is always rendered). 2) The values for SetMaterialEnvironmentMap(...) were passed in the wrong order (I assume that "1" is the material index of your model?) 3) You passed the index of the cube texture to SetModelMaterial(...), while it should be the index of the material that your model uses (that would be 1 if my previous assumption is correct). So it should be like this:
This code should be used only once, like in the Create Event of your model object. If you want to update the reflection of the environment regularly, you need to call RenderToCubeTexture(...) repeatedly, in the Step or Alarm Event of an arbitary object for example. Hope this helps :). |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| Zedman3d | Sep 14 2007, 10:40 AM Post #3 |
![]()
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Grrr. Its not working. I can never get any of this sort of thing to work. And before you ask, yes. I do support cube mapping.... Wtf is wrong with me....
|
| |
![]() |
|
| MysteriXYZ | Sep 14 2007, 12:58 PM Post #4 |
|
Master Matrix Masher
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Hopefully this example can help you. Check out the Create & Step Events of the Mirror object. There is something strange with these reflections, though; when moving sideways along the mirror, the reflection behaves as expected, but when you walk into the mirror, the reflection moves into the mirror as well. Try it out to see what I mean. |
| U3D is like candy; after extensive consumption, it's Best to brush. | |
![]() |
|
| Zedman3d | Sep 15 2007, 01:27 AM Post #5 |
![]()
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yay, thanx it works. The glitch is fine anyway, i can work around it and with it.
Thanx again. |
| |
![]() |
|
| Andrew75 | Sep 17 2007, 05:59 PM Post #6 |
|
Andrew75
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
hey ya your right,, anyways looks like the reflection is being caused by how the polugons are layed out, i think it could be fixed by uping the poly count, but that woudnt be very nice, wonder if theres another way to do reflections ? or maybe a code fix ?
|
![]() (SONIC CD REMIX) check out my vids http://www.youtube.com/profile?user=tuxmask75 Check out our projects vids http://www.youtube.com/profile?user=AXSXProject | |
![]() |
|
| Andrew75 | Sep 17 2007, 06:19 PM Post #7 |
|
Andrew75
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Actually uping the poly count didnt help eather,,![]() |
![]() (SONIC CD REMIX) check out my vids http://www.youtube.com/profile?user=tuxmask75 Check out our projects vids http://www.youtube.com/profile?user=AXSXProject | |
![]() |
|
| skarik | Sep 18 2007, 06:02 AM Post #8 |
|
kitten eating scum
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Does turning the edges work? |
| Blog|EHS | |
![]() |
|
| Zedman3d | Sep 18 2007, 06:52 AM Post #9 |
![]()
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
try making each face a quad. |
| |
![]() |
|
| Matrix_Square | Sep 18 2007, 07:47 AM Post #10 |
![]()
Matrix Square Entertainment Developer
![]() ![]() ![]() ![]() ![]() ![]()
|
That doesn't matter, during the rendering stage, the GPU will automatically tesselate your model into tri's. |
| SPRING time PROGRAMMING - GM & Ultimate3D Tutorials | |
![]() |
|
| Andrew75 | Sep 18 2007, 02:03 PM Post #11 |
|
Andrew75
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
no turning the edges wont work because there will still be tryangles, i think it just be the way the reflections work. wonder if there is a better way to do the reflections ? |
![]() (SONIC CD REMIX) check out my vids http://www.youtube.com/profile?user=tuxmask75 Check out our projects vids http://www.youtube.com/profile?user=AXSXProject | |
![]() |
|
| silverfire56 | Sep 18 2007, 03:52 PM Post #12 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
tessellate eeh? take advantage of that or maybe change the texture cords ($10 bucks on this) ether that or wait till "dr. best" posts, with his simple and obvious fix that we will wonder why we didn't think of that
|
![]() |
|
| Dr. Best | Sep 18 2007, 04:05 PM Post #13 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I have two assumptions why this may be happening. The first one is that it's the result of the small error that results from the way this technique works in. You will never get 100% correct results, because the cube map gets computed only for one point. To get it absolutely correct one would need to compute one cube map (actually just one pixel) for every position on the surface of the object
. But since your ground model seems to be very big in comparison to the cube object, this probably isn't the cause of the problem. Assumption number two is that Direct3D is a bit imprecise when calculating the reflection vector, but I don't think that an imprecision like this could become that strong.The only possible solution I could think of would be using a vertex shader to compute the reflection vector. This may lead to more precise results. |
![]() |
|
| Xeniczone | Sep 18 2007, 10:18 PM Post #14 |
|
Elite Member
![]() ![]() ![]() ![]() ![]() ![]()
|
So how would you make a reflection using vertex shaders? and would it improve proformance over Cube mapping? |
Comcast sucks!
| |
![]() |
|
| Dr. Best | Sep 19 2007, 01:02 PM Post #15 |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
A simple vertex shader that doesn't do much more than computing the default transformations and calculating a reflection vector would be needed here. The performance would be exactly the same as for the usual solution, because it's exactly the same technique with the only difference that the common approach uses the fixed function pipeline instead of a vertex shader. |
![]() |
|
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |






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









2:35 AM Jul 11