First useable Mirror for A6 Commercial

Posted By: Jerome8911

First useable Mirror for A6 Commercial - 02/08/05 22:57

Hi,

The first useable Mirror for A6 Commercial, but with a little Problem.
I know it isn't really a shader, but it was one before i modified it, so I hope there will be no problems.
But now the code:
Code:
  
var Video_mode = 7;
var video_depth = 32;
var video_screen = 1;

////////////////////////////////////////////////////////////////////////////////

entity glow_quad

{

type = <yourtex.tga>; //128*128 works best but can be any size

//this entity is always invisible..
}


////////////////////////////////////////////////////////////////////////////////
dllfunction render_backbuffer(entity);

function main()
{
dll_open("render_view.dll");

level_load("Shader_lvl1.wmb");

while(1) {
me=glow_quad;

temp.x = camera.x;
temp.y = camera.y;
temp.z = camera.z;

camera.x = -50;
camera.y = 181.000;
camera.z = -65;
camera.pan = -camera.pan;

wait(0.1);

render_backbuffer(me);
camera.x = temp.x;
camera.y = temp.y;
camera.z = temp.z;
camera.pan = -camera.pan;
wait(10);
}
}



To use it you need the renderview.dll from Matt Aufderheide, somewhere in the forum, and you need to create a sprite. This sprite must be the yourtex.tga.
This sprite is now the mirror.

The problem is difficult to desribe, and it's not possible to make a screenshot of it. I think the best would be to test it.

Perhaps somebody can fix the problem, but i see no possibility.
Posted By: Braxton

Re: First useable Mirror for A6 Commercial - 02/10/05 08:00

very nice, haven't tried it yet due to the fact that i can not find Mat's .dll

I noticed it uses a sprite, can i use a model?

Example:

Code:

entity glow_quad
{
type = <mirror.mdl>;
}




Posted By: Yulor

Re: First useable Mirror for A6 Commercial - 02/10/05 08:38

I'm pretty sure documentation already exists for faking mirrors even in the standard version.
Posted By: Jerome8911

Re: First useable Mirror for A6 Commercial - 02/11/05 00:28

@ Braxton. Yes you could also assign it to a model, but in a different way, because Matts DLL makes a fast screenshot (btw.: thats the problem of the mirror).
It would be possible to realize it with a shader, for example with the watershader from steempipe. Steempipes watershader uses a extern skin for his water.

@Yulor. It isn't a fake mirror. The mirror is 100% correct. The only problem is the fast switching of the camera between two positions.

The link to the renderview.dll:
renderview

MfG
Jerome
Posted By: Metal_Thrasher

Re: First useable Mirror for A6 Commercial - 02/11/05 12:52

THe problem I'm having is that the mirror is mirroring what the player sees and not what the mirror "sees"
Posted By: Braxton

Re: First useable Mirror for A6 Commercial - 02/11/05 13:12

I can't get it to work, the sprite is placed where i want it to be, but it is invisible and does not reflect anything.

BTW - I reanamed the sprite as mirror.pcx
Posted By: muralist

Re: First useable Mirror for A6 Commercial - 02/12/05 07:16

6.31.4 Commercial

I added the script to my level, made and placed a sprite called Mirror128.tga, added render_view.dll to the project directory, and got the errors:

Malfunction 1526 engine_getobj - function not available for DLL
Malfunction 1526 engine_getfunc - function not available for DLL
Malfunction 1526 engine_getscript - function not available for DLL
Malfunction 1526 engine_callname4 - function not available for DLL
and so on...

Heres the main script

...include <Mx_FX_Environment.wdl>;...
////////////////////////////////////////////////////////////////////////////

entity glow_quad
{
type = <Mirror128.tga>; //128*128 works best but can be any size
//this entity is always invisible..
}
dllfunction render_backbuffer(entity);

// Desc: The main() function is started at game start
function main()
{
// no level has been loaded yet...
gid01_level_state = gid01_level_not_loaded;
// entry: Warning Level (0,1, or 2)
// entry_help: Sets sensitivity to warnings (0 = none, 1 = some, 2 = all).
warn_level = 2; // announce bad texture sizes and bad wdl code
// entry: Starting Mouse Mode (0, 1, or 2)
init_mouse();
mouse_mode = 1;
game_init(); //activate some crap
Node_Init();
Mouse_Init();
change_sky();
SunMove();
MoonMove();
lightmove();
init_time();
load_water_fx();
init_animsprite();
texture_scan();
start_music();
//generate_forest();
//MP if not a single player game, wait for connection
ifdef server;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;

ifdef client;
while(connection== 0) {wait(1);} // wait until level loaded and connection set
endif;

//MP
if (connection !=2 && connection != 1)
{
number_players = 1;
player_number = 1;
}
on_mouse_right = null;
wait(3);

title_pan.visible = on;
black_pan.visible = on;
black_pan.transparent = on;
black_pan.alpha = 100;
while(black_pan.alpha > 0) {
black_pan.alpha = max(black_pan.alpha - 5 * time,0);// Greg was 10
wait(1);
}
media_loop(levelmus,null,100);

freeze_mode = 1;
gid01_level_state = gid01_level_not_loaded;

//center the splash screen for non-640x480 resolutions, and display it
//splashscreen.pos_x = (screen_size.x - bmap_width(splashmap))/2;
//splashscreen.pos_y = (screen_size.y - bmap_height(splashmap))/2;
//splashscreen.visible = on;
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);

dll_open("render_view.dll");
// level_load("Shader_lvl1.wmb");

// now load the level
level_load(level_str);
wait(2);

while(1) {
me=glow_quad;

temp.x = camera.x;
temp.y = camera.y;
temp.z = camera.z;

camera.x = -50;
camera.y = 181.000;
camera.z = -65;
camera.pan = -camera.pan;

wait(0.1);

render_backbuffer(me);
camera.x = temp.x;
camera.y = temp.y;
camera.z = temp.z;
camera.pan = -camera.pan;
wait(10);
}

ifdef USE_NEWTON_GAME_DYNAMICS;
wait(1);
dll_handle = newtonHandle;
NewtonAddMap (level_str, splashscreen);
endif;
//sleep(6);
//splashscreen.visible = off;
//bmap_purge(splashmap); // remove splashscreen from video memory
gid01_level_state = gid01_level_loaded;

How do I get this to run?
Posted By: Wiz

Re: First useable Mirror for A6 Commercial - 03/19/05 03:26

Try putting the dll_open as the first line of your main function. This solved a similar problem for me.
Posted By: Greenmonkey824

Re: First useable Mirror for A6 Commercial - 03/25/05 05:55

Quote:

THe problem I'm having is that the mirror is mirroring what the player sees and not what the mirror "sees"




That could be fixed with a C++ extension. I presume the mirror takes a screenshot of what its camera sees. So, what you need to do is have the screenshot flipped horizontally (like Photoshop does it) before being appended to the sprite. This is probably doable with a dll or something. However, I don't know the C++ code for this, so you might want to swipe it from an open-source Photoshop alternative.
Posted By: Matt_Aufderheide

Re: First useable Mirror for A6 Commercial - 03/25/05 15:26

No, what he means is that it can't really be a reflection, becasue its from the camera view, not mirror view. there is no way to fix this without writing a whole rendering scheme as a DLL. All my current dll does is take the backbuffer and blit on a texture. This just a fast way of taking a low res screenshot, and is really only meant for bloom and blur effects, not mirrors.
Posted By: Orange Brat

Re: First useable Mirror for A6 Commercial - 03/25/05 16:18

Quote:

Try putting the dll_open as the first line of your main function. This solved a similar problem for me.





Unrelated to this thread but dll_open is deprecated and isn't even in the manual anymore. Simply include a plugindir = "folder name"; and make sure the dll is in that folder. The engine will automatically open and close it for you.

Quote:


plugindir





Gives a folder for engine plug-in DLLs. The engine automatically opens all DLLs copied into this folder.







Default:
"gstudio6\acknex_plugins" in development mode,
"." (current folder) in release mode.








Remarks:
'\' must be given in C notation as '\\'. The folder name must not end with '\'. "." refers to the current project folder.







Example:
plugindir = "plug-ins"; // open Dlls in the "plug-ins" subfolder




© 2024 lite-C Forums