3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1] 2

Author Topic: Creating a realistic mirror  (Read 2646 times)

« on: March 08, 2011, 03:16:19 PM »
Hello, what is the best way to make a mirror in 3D Rad? I tried a plan with a white texture and the glass shader but that did not effectively make reflections only modified the opacity.

jestermon

« Reply #1 on: March 09, 2011, 06:05:55 AM »
The only "true" mirror you can get is to use another camera, placed somewhere in a corner of your screen. Once (if ever) "render to texture" becomes available, then you could apply the texture to a surface.
« Reply #2 on: March 09, 2011, 11:34:47 AM »
Sure ok I follow. Yea I was looking in the coding documentation to see if there was a code to do that. What about modifiying the glass shader? Or writing my own shader is that a possibility?

jestermon

« Reply #3 on: March 09, 2011, 12:47:16 PM »
I'm not into shaders, so I have no idea. Maybe shadmar knows
@shadmar??

psikoT

« Reply #4 on: March 09, 2011, 01:27:24 PM »
@shadmar??

that's the call to our hero... ;D tanananiiii na niiiii
« Reply #5 on: March 09, 2011, 03:38:48 PM »
does anyone know how to code a shader? Is there some documentation on it?
« Reply #6 on: March 09, 2011, 04:00:34 PM »
« Reply #7 on: March 09, 2011, 05:27:53 PM »
You can do mirror with default the built-in shaders (0001_pp_smooth) using envmapping (reflection factor to 1) and a small script to set env focus.

Code: [Select]
      Vector3 v1,v2;
      int CAMERA=OBJ_0;
      int OBJECTSKINMESH=OBJ_22;

      float FineTuneRefraction = 3.75f;  //adjust relative to camera y.
      iObjectLocation(CAMERA,v1);//camera
      iObjectLocation(OBJECTSKINMESH,v2);//flat plane
      iObjectEnvMapFocusSet(OBJECTSKINMESH,Vector3(v1.x,v1.y+((v2.y/2.0f)-FineTuneRefraction),v1.z)); //set focus



« Last Edit: March 09, 2011, 05:31:10 PM by shadmar »
« Reply #8 on: March 10, 2011, 12:17:53 AM »
You can do mirror with default the built-in shaders (0001_pp_smooth) using envmapping (reflection factor to 1) and a small script to set env focus.

Code: [Select]
      Vector3 v1,v2;
      int CAMERA=OBJ_0;
      int OBJECTSKINMESH=OBJ_22;

      float FineTuneRefraction = 3.75f;  //adjust relative to camera y.
      iObjectLocation(CAMERA,v1);//camera
      iObjectLocation(OBJECTSKINMESH,v2);//flat plane
      iObjectEnvMapFocusSet(OBJECTSKINMESH,Vector3(v1.x,v1.y+((v2.y/2.0f)-FineTuneRefraction),v1.z)); //set focus



Thanks for the response. Ok so I turned environment map on and I added this script but nothing happens. I get blue clouds in my mirror
Code: [Select]
void Main()
{
      Vector3 v1,v2;
      int CAMERA=OBJ_0;
      int OBJECTSKINMESH=OBJ_44;

      float FineTuneRefraction = 1.31912f;  //adjust relative to camera y.
      iObjectLocation(CAMERA,v1);//camera
      iObjectLocation(OBJECTSKINMESH,v2);//Dressing Room
      iObjectEnvMapFocusSet(OBJECTSKINMESH,Vector3(v1.x,v1.y+((v2.y/2.0f)-FineTuneRefraction),v1.z)); //set focus
}
« Last Edit: March 10, 2011, 12:21:28 AM by kmccmk9 »

PsychoWeasel9

« Reply #9 on: March 10, 2011, 06:53:12 AM »
Set the envmap refresh rate, so that the reflection object actually shows your scene.  You also have to select "display in reflections" for skinmesh/skyboxes, etc
« Reply #10 on: March 10, 2011, 11:46:44 AM »
Ok so now I have all of my objects appear zoomed in the mirror.
« Last Edit: March 10, 2011, 02:25:26 PM by kmccmk9 »
« Reply #11 on: March 10, 2011, 02:07:46 PM »
60 or 75 get a smooth reflection.

Also the higher resolution your envmap is the sharper reflection will be..
Also the more vertices in the "mirror" skinmesh you have the more accurate the reflection will be.

Here is a demo using default objects (saved using rad 7.11)
« Last Edit: March 10, 2011, 02:09:58 PM by shadmar »
« Reply #12 on: March 10, 2011, 02:15:03 PM »
Shad... you never cease to amaze...

that scene looks great...

i never thought about using the default shaders for a mirror effect... thanks for the technique...

(i've been outta the loop for a few days... in fed court arguing a case)


--Mike
« Reply #13 on: March 10, 2011, 06:32:16 PM »
60 or 75 get a smooth reflection.

Also the higher resolution your envmap is the sharper reflection will be..
Also the more vertices in the "mirror" skinmesh you have the more accurate the reflection will be.

Here is a demo using default objects (saved using rad 7.11)

Ok my reflection is still blurry and zoomed in. No idea why though.
« Reply #14 on: March 11, 2011, 10:47:15 AM »
yeah... i can't seem to get the sharp clear reflection images you seem to be getting...

i increased the vertex count and increased the res of the 000_em image to 2048, but no joy...


my reflections are still blocky...


--Mike
Pages: [1] 2