different renderer?

Posted By: lostclimate

different renderer? - 10/12/06 04:08

well i posted this in the third-party tools, but in hindsight i should have posted it here, since it isnt necessarily 3rd party related, ok i figured id ask you guys youselves since matt told me he didn't think so i figured id make sure. Is there a way to disable 16 rendreing, and do the rendering through the use of a different engine, my question is because i prefer irrlichts rendering system, bloodline said he'd done it with ogre, but the a6 renderer still had shown through, so if there is a way to turn of a6 rendering, how do you go about doing it?
Posted By: jcl

Re: different renderer? - 10/12/06 06:05

Sure, you can implement any other renderer into A6, through a DLL plugin. That's what Matt is doing with his sphere engine. A6 won't "show through". However you'll need good C++ and DirectX knowledge for that.
Posted By: lostclimate

Re: different renderer? - 10/12/06 06:34

well what if we dont know all the inner workings of the engine like we programmed it? i am using irrlicht, and i dont want to rewrite my own rendering engine like him, i want to instead use a completely different, i understand it would use a dll, but how would i go about a6 to render at all?
Posted By: jcl

Re: different renderer? - 10/12/06 06:49

You first need an external renderer, from Irrlicht or whatever, that is able to render DirectX meshes. Then you use the render material event for calling the external render function with the current entity mesh. This way the external mesh renderer will draw the mesh into A6's back buffer, instead of A6's own mesh renderer. I think it would not make much sense with Irrlicht, which probably renders meshes slower than A6, but it would work.
Posted By: lostclimate

Re: different renderer? - 10/12/06 07:57

well i want to get features such as render to texture and such. and possibly get shaders to work on standard and extra along with dynamic shadowing. im not sure how fast each renders meshes.
Posted By: TWO

Re: different renderer? - 10/12/06 08:53

Oh, so we just can go this way? I tought about writing a function like (just exemple):

DLLFUNC var A6R_ent_create(xyz)
{
ent_create(xyz);
Entity* Ent = A6Render::getSingleton().getSceneMgr()->createEntity( "oli", "ogrehead.mesh" );
A6Render::getSingleton().getSceneMgr()->getRootSceneNode()->attachObject( Ent );
}

and then check in a linked list if position has changed, etc. I know, would not be the best solution, but ogre is really a great pice of code.

I tried that way, setting ogreīs rendering window not to auto create itīs window, but to use a6 rendering device. Didnīt work.

p.s Iīm writing on a little allready running engine when Iīm bored, so my skills may be not the problem; And Iīve taken a look on working with dx one year ago.
Posted By: jcl

Re: different renderer? - 10/12/06 09:50

No, that would be quite awkward. The official method is the following:

DLLFUNC int Render(void)
{
ENTITY* pEntity = (ENTITY*)ev->me;
BMAP* pSkin = (BMAP*)ev->render_map[0];
LPD3DXMESH pMesh = (LPD3DXMESH)ev->render_mesh;
LPD3DMATERIAL9 pMaterial = (LPD3DMATERIAL9)ev->render_d3dmaterial;
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)ev->render_d3dxeffect;
IDirect3DDevice* pD3dDev = (IDirect3DDevice*)ev->pd3ddev;
Ogre_Render(pD3dDev,pMesh,pSkin,pMaterial,pEffect); // your own render function
return 1; // tell A6 not to render this entity
}

Now you assign this function to the material event:

ev->mat_model->event = Render;
ev->mat_model->flags |= ENABLE_RENDER;

That's all. Hope this makes sense.
Posted By: TWO

Re: different renderer? - 10/12/06 10:06

Ah, got a bulb over my head
Posted By: lostclimate

Re: different renderer? - 10/12/06 13:20

see you have a bulb over your head....
im in under my head....
well ill try what i can.
Posted By: TWO

Re: different renderer? - 10/12/06 14:19

Sry, itīs me again;

I sat up a simple test. But the render donīt get called:
Code:

DLLFUNC int ERender_Eentity()
{
error("Hello Urmel!");

// Get all data
ENTITY* pEntity = (ENTITY*)ev->me;
BMAP* pSkin = (BMAP*)ev->render_map[0];
LPD3DXMESH pMesh = (LPD3DXMESH)ev->render_mesh;
D3DMATERIAL9* pMaterial = (D3DMATERIAL9*)ev->render_d3dmaterial;
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)ev->render_d3dxeffect;
IDirect3DDevice9* pd3dDevice = (IDirect3DDevice9*)ev->pd3ddev;


// Render (just a test, donīt know if it does sth)
if( SUCCEEDED( pd3dDevice->BeginScene() ) )
(...)

return 1;
}

DLLFUNC void ERender_Init()
{
ev->mat_model->event = (EVENT)ERender_Eentity;
ev->mat_model->flags |= ENABLE_RENDER;
}

dllfunction ERender_Init();



But the 'Hello Urmel' donīt apears; I tried Xerxes way, render_entities=ERender_Eentity;, but didnīt work either (got Urmel, but the ents didnīt disappear).

Blubīs damaged?
Posted By: jcl

Re: different renderer? - 10/12/06 15:07

Yep. The material must contain an effect, otherwise the event is not called. The content of the effect does not matter, but it must be there.

Quote:

enable_render
If this flag is set, the material's event function is executed at the beginning of every entity rendering, if the material contains an effect and was assigned to the entity. This can be used to perform effect calculations based on entity skills or the entity's world matrix.


.
Posted By: lostclimate

Re: different renderer? - 10/12/06 19:06

what do you mean by effect?
Posted By: FBL

Re: different renderer? - 10/12/06 22:30

it needs a "do something"
Posted By: lostclimate

Re: different renderer? - 10/13/06 03:28

have you got anything working yet bloodline, because if you do pm me, because maybe you can give me a nudge in the right direction.
Posted By: TWO

Re: different renderer? - 10/13/06 22:44

Code:

DLLFUNC int ERender_Eentity()
{
// Get all data
ENTITY* pEntity = (ENTITY*)ev->me;
BMAP* pSkin = (BMAP*)ev->render_map[0];
LPD3DXMESH pMesh = (LPD3DXMESH)ev->render_mesh;
D3DMATERIAL9* pMaterial = (D3DMATERIAL9*)ev->render_d3dmaterial;
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)ev->render_d3dxeffect;
IDirect3DDevice9* pd3dDevice = (IDirect3DDevice9*)ev->pd3ddev;

struct VERTICES{float x, y, z, w;};
VERTICES v[2];
v[0].x = 100; v[0].y = 100; v[0].z = 0.0; v[0].w = 1.0;
v[1].x = 200; v[1].y = 100; v[1].z = 0.0; v[1].w = 1.0;
// open the scene and get the active D3D device
draw_begin();
if(!pd3dDevice) return 0;

pd3dDevice -> SetRenderState(D3DRS_LASTPIXEL, FALSE);
pd3dDevice -> SetRenderState(D3DRS_CLIPPING, FALSE);
pd3dDevice -> SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
// Render line on-screen
pd3dDevice -> SetFVF(D3DFVF_XYZW);
pd3dDevice -> DrawPrimitiveUP(D3DPT_LINELIST, 1, static_cast<LPVOID>(v), sizeof(VERTICES));

return 1;
}

DLLFUNC void ERender_Init()
{
ev->mat_model->event = reinterpret_cast<EVENT>(ERender_Eentity);
ev->mat_model->flags |= ENABLE_RENDER;
}



This pice does sth and returns 1. I tried it the Init and the Xerxes way, both failed. I know, it does work for 1000+ people, but I still donīt get it

p.s nope, lostclimate, but I didnīt looked long at it, my mum has b-day
pp.s two germans speaking english... interesting
Posted By: jcl

Re: different renderer? - 10/16/06 09:19

This still will not work because the effect is missing.

See the new C++ FAQ page -> http://manual.conitec.net/prog_faq.htm
Posted By: lostclimate

Re: different renderer? - 10/16/06 14:32

wow, i searched and searched the manual, and i only wish i had the found that EXACTLY answers my question, lol.



EDIT: and even now... i still dont get it, it looks like the only way to do it is to use your own rendering effect, not to completely switch out renderers, wanted to just use irrlichts rendering device.
Posted By: lostclimate

Re: different renderer? - 10/25/06 13:36

anyone manage to get this even partially there yet?, im gonna try working on it again today
Posted By: lostclimate

Re: different renderer? - 10/25/06 14:54

well so far i have got irrlicht to run in a 3dgs wrapper, not too much help, but at least i got the dll making/using concept down.
Posted By: lostclimate

Re: different renderer? - 10/25/06 15:08

ENTITY* pEntity = (ENTITY*)ev->me;
BMAP* pSkin = (BMAP*)ev->render_map[0];
LPD3DXMESH pMesh = (LPD3DXMESH)ev->render_mesh;
LPD3DMATERIAL9 pMaterial = (LPD3DMATERIAL9)ev->render_d3dmaterial;
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)ev->render_d3dxeffect;
IDirect3DDevice* pD3dDev = (IDirect3DDevice*)ev->pd3ddev;
Ogre_Render(pD3dDev,pMesh,pSkin,pMaterial,pEffect); // your own render function


what format are these returned in, like bmap, im gonna guess will return it in the type that you put in, but, irrlicht obviously doesnt support 3dgs meshes, so what does this all do?
Posted By: FBL

Re: different renderer? - 10/25/06 15:20

You need a function which renders all the objects in Irrlicht of course...

You need to replace this call
Ogre_Render(pD3dDev,pMesh,pSkin,pMaterial,pEffect); // your own render function
with your own function
Posted By: lostclimate

Re: different renderer? - 10/25/06 15:35

i know, but im talking about the mesh format that is sent from there, i get it now tho, now im trying to figure out how to set the passed device up in irrlicht. Im doing this will almost no knowledge on directx's inner workings.
Posted By: lostclimate

Re: different renderer? - 10/25/06 15:48

also, what about the bmap, how is that passed through the funciton?
Posted By: TWO

Re: different renderer? - 10/25/06 16:13

Hä? *g*

If Irrlicht has a dx9 render, you should be able to work direcly with the data;

For Irrlichts device, I donīt know, look at code exemples in the forums or sth like that, this is where I found how to set OGREs device to the window.
Posted By: lostclimate

Re: different renderer? - 10/25/06 16:19

well right now i need to know the handle for the window, that way i can set irrlichts dx renderer to that window.
Posted By: TWO

Re: different renderer? - 10/25/06 17:41

http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/694501/an/0/page/0#Post694501
Posted By: lostclimate

Re: different renderer? - 10/25/06 21:59

well it didnt help because i keep getting that acknex_mainwin is undefined and i dont know what to do with the other thing, do you think you could post what you used?
Posted By: lostclimate

Re: different renderer? - 10/26/06 02:48

ok, this should work and its not:
Code:
param.WindowId =reinterpret_cast<s32>(FindWindow(reinterpret_cast<LPCTSTR>("acknex_mainwin"),0));


the windowId needs to retruen a s32 type, so i did the reinterpret_cast for that, the name of the class should be right what else do i need?
Posted By: lostclimate

Re: different renderer? - 10/26/06 04:11

OK... i got irrlicht to run in the a6 window, the issue is, all i have now is a window that flickers between my a6 blank screen and the irrlicht program i integrated into it, is there anyway to just take the directx view completely off the window?
Posted By: TWO

Re: different renderer? - 10/26/06 04:18

Did you try to make the camera invisible? And set the backround color to 0,0,0
donno if it works, but this is the only thing that comes into my mind

p.s use "HWND hWnd = ev->hWnd;" not my brute force method
Posted By: lostclimate

Re: different renderer? - 10/26/06 04:24

heres what i get with it:
http://www.lostclimategames.com/irrlicht_test.zip


I can't show pics, because whenever i try to take a screenshot it just takes a picture of it with the a6 renderer in front
Posted By: TWO

Re: different renderer? - 10/26/06 04:28

Downloaded, but dx8.dll is missing; But you didnīt set the cam invisible / backround at 0,0,0
Posted By: lostclimate

Re: different renderer? - 10/26/06 05:33

well the download now has all the needed dlls, so may want to retry now, what do you mean buy seting the cam invisible/background at 0,0,0?
Posted By: FBL

Re: different renderer? - 10/26/06 06:58

camera.visible = off;
vec_set(screen_color,vector(0,0,0));
Posted By: lostclimate

Re: different renderer? - 10/26/06 12:43

i tried that, i get the same thing
Posted By: lostclimate

Re: different renderer? - 11/01/06 23:12

so there is no way to fix this, nobody can help me?
please even if you have a theoretical idea that you havent tested please tell me, this is very important to me
Posted By: lostclimate

Re: different renderer? - 03/01/07 03:49

well sorry to bump this but i am getting a bit better with c++ (only slightly)

but could somebeody explain what this: [url] http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=19474 [/url] means? the last reply at least? im just asking mainly JCL, but if someone else knows itd be nice to have there input too
Posted By: TWO

Re: different renderer? - 03/01/07 13:47

Ok, to render something, you need to pass the mesh itself, normals and some other params, don't remember the exact things. It's up to the user in which order to pass them. But you need to tell Dx this. Just look at the Dx9 SDK exemples

Second, irrlicht uses it's own formats, you have to create a blank modell description in irrlicht and fill it with the data returned from A6, like that user allready said. You need to know both, the irrlicht and the dx mesh format to convert it. But I'm sure someone has allready done sth like this.

Provide some code and I'll tell you what I would do
Posted By: lostclimate

Re: different renderer? - 03/01/07 21:22

well im trying to figure out what code im supposed to provide, i looked into all there meshbuffer stuff, but since i dont understand how to figure out what meshbuffer format each uses, i have no idea how i'd convert it.
Posted By: jcl

Re: different renderer? - 03/02/07 16:43

You need to convert the vertex format. I don't know Irrlicht's vertex format, but you'll find the A6 vertex format in the manual under "Shaders". This should be relatively easy.
Posted By: lostclimate

Re: different renderer? - 06/03/08 07:26

haha time to reopen this post :P

now i have a little more c++ expirience under my belt but not too much dx (I know the basics)

my question is this. do we have to do our own matrix transformations? I figure we probably do but is there a way to utilize 3dgs transformation code temporarily to see if my rendering code is right, and then after I am sure of that, then start redoing the transformations (im no longer trying to use irrlicht, I'd like to attempt to re-write the renderer).
Posted By: Tobias

Re: different renderer? - 06/05/08 08:01

I think this depends on the coordinate system you use, if your renderer uses the DirectX coordinate system and a similar scaling as A7 you can use the transformation matrices, and otherwise you have to calculate your own matrices. Directx has simple functions for transformation matrices so it shouldnt be a problem.
© 2024 lite-C Forums