Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,490 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can not get floor_mirror working #234573
11/03/08 16:49
11/03/08 16:49
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
Hi! I have cube model, which emulates floor. I want to make mirror from it.
Firstly, I include this :
Quote:
#include "mtlFX.c"


then, I do this :
Quote:
//Assign shaders
me = ent_for_name("mirror");
my.skill41 = floatv(50); // facAmbient
my.skill42 = floatv(50); // facDiff
my.skill43 = floatv(50); // facSpec
my.skill44 = floatv(50); // shininess

my.material = mtl_floor_mirror;


I can see, that cube receives material, because he stops receiving shadows. However, nothing else happens. It is just simple textured model,
and not a mirror. Do I missing something? I use A 7.50 Commercial.

Last edited by RyuMaster; 11/03/08 17:00.

What kills me not, that makes me stronger.

***Working on RPG/RTS***
Re: Can not get floor_mirror working [Re: RyuMaster] #235477
11/07/08 21:11
11/07/08 21:11
Joined: Aug 2006
Posts: 155
R
RyuMaster Offline OP
Member
RyuMaster  Offline OP
Member
R

Joined: Aug 2006
Posts: 155
After long stupid testings, I managed to get shader working. But, I have first-person camera, and I need to see my player mirrored in
vertical mirror. So far, this shader works only for horizontal surface. I'm currently trying to adapt it for vertical, but with no
luck for few hours. If someone has made it already, please, share. Or I'll post working sample here if I ever finish it myself.


Quote:
MATERIAL* mtl_floor_mirror =
{
effect="floorMirror.fx";
}

//enable: Mirror debugging
//help: Make mirror view visible by pressing F11
//id: 22
//#define MIRROR_DEBUG

#ifdef MIRROR_DEBUG
VIEW* view_mirror = { layer = 1; }
#else
VIEW* view_mirror = { layer = -1; } // render mirror view before camera view
#endif
BMAP* bmap_mirrortarget = NULL;
var mtlfx_mirrorvisible = 0;

//Simulate a horizontal mirror by generating
//a camera view from below through the floor
function fx_mirror()
{
// do nothing if mirror is already running
if (bmap_mirrortarget) {
my.material.skin2 = bmap_mirrortarget;
return;
}

bmap_mirrortarget = bmap_createblack(256,256,888);
my.material.skin2 = bmap_mirrortarget;
view_mirror.bmap = bmap_mirrortarget;
view_mirror.size_x = bmap_width(view_mirror.bmap);
view_mirror.size_y = bmap_height(view_mirror.bmap);

vec_set(view_mirror.pnormal_x,vector(0,0,1.0)); // reflect upwards
set(view_mirror,NOSHADOW|NOCULL|PORTALCLIP);
// suppress shadows in the mirror, look through walls, and clip at portal plane

//enable: Suppress FLAG1 in mirror
//help: Don't display FLAG1 objects in the mirror views
//id: 23
set(view_mirror,NOFLAG1); // suppress all entities with flag1 set

//enable: Suppress particles in mirror
//help: Don't display particles in the mirror views
//id: 24
set(view_mirror,NOPARTICLE);

//enable: Suppress shaders in mirror
//help: Don't render material effects in the mirror views
//id: 25
set(view_mirror,NOSHADER);

while (bmap_mirrortarget)
{
proc_mode = PROC_LATE; // camera must be moved and mtlfx_mirrorvisible set before
if (mtlfx_mirrorvisible)
{
set(view_mirror,VISIBLE);
view_mirror.genius = camera.genius;
view_mirror.aspect = (screen_size.x/screen_size.y)*camera.aspect; // screen aspect, independent of render target
view_mirror.arc = camera.arc;
view_mirror.fog_start = camera.fog_start;
view_mirror.fog_end = camera.fog_end;
view_mirror.clip_far = camera.clip_far * 0.5;
view_mirror.clip_near = camera.clip_near * 2;
view_mirror.x = camera.x;
view_mirror.y = camera.y;
view_mirror.z = 2*view_mirror.portal_z-camera.z; // move the camera at its mirror position
view_mirror.pan = camera.pan;
view_mirror.tilt = -camera.tilt; // flip the vertical camera angle
view_mirror.roll = -camera.roll;
}
else {
// switch rendering off when all mirror objects are outside the frustum
reset(view_mirror,VISIBLE);
}
mtlfx_mirrorvisible = 0;

#ifdef MIRROR_DEBUG
if (key_f11) { // debugging - make mirror visible onscreen
view_mirror.bmap = NULL;
} else {
view_mirror.bmap = bmap_mirrortarget;
}
#endif
wait(1);
}
}



What kills me not, that makes me stronger.

***Working on RPG/RTS***

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1