Use draw_quad outside the window / render on bmap

Posted By: Benni003

Use draw_quad outside the window / render on bmap - 09/30/15 16:36

Hi, I am working on a 2d strategy Game!
For rendering the Graphics I use draw_quad(), because its faster than with panels for my purpose.
Now I want to include a zoom function. First I tried with scaling through the draw_quad() function, but if I scale the grapfics smaller i have an aliasing effect, the graphics don't look good. I think I need a filter, but how...?
I tried with rendering the pgraphics on a bmap... creating a bmap, useing bmap_rendertarget() and set the bmap to a panel with Filter flag. Now I am able to scale the Panel and with it the whole rendering. but the problem is, that draw_quad() is not working outside the window... if I zoom out I have following problem:



Does Anyone have an Idea to work around?
Posted By: Superku

Re: Use draw_quad outside the window / render on bmap - 09/30/15 16:55

I don't have a direct solution for your problem but have you thought about using sprites and ISOMETRIC rendering?
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 09/30/15 19:01

Yes I have throught about it. I want to make a traditional 2d game and there should be a possibility to transfer it to other platforms and Browser without a 3d engine. I've not planned it yet, but I want to have the option. This are the two reasons.

So I'm serching a solution for my problem...
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 09/30/15 19:32

Can you run a scene-screen anti-aliasing.
d3d_antialias = 4 or 9; // activate scene antialiasing

or
Postprocessing shader

Was it Helix that posted a scene space AA shader with his bloom shader long ago?

So that's me guessing. Maybe it will be helpful
Mal
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 09/30/15 19:42

I think this is not working. d3d_antialias I tried also, but not working. I have no Level loaded so Im not using a view.
I have just the engine window.
But how is the FILTER flag of Panels working? Is it possible to have something like the Panel FILTER flag for the whole window?
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 09/30/15 20:20

Ok some more info I should have looked up

Manual
Quote:
Global antialiasing settings in the 3D card settings menu will make panels and bitmap fonts look blurry, depending on the 3D hardware and driver version. Use only d3d_antialias for scene antialiasing.

http://www.conitec.net/beta/apanel.htm

Now I can assume somethings. Panels are created with dx9 function. Direct_3d because direct_draw was removed. To get a good understand I'd have to ask the dev. There are some flag like settings I found looking up d3dx9 and maybe this filter flag is just on of them. I assume we can access dx9 so should be able to it turn a anti aliasing for d3d quid. But I'm all guessing
This 'doesn't seem to apply https://msdn.microsoft.com/en-us/library/windows/desktop/bb173422(v=vs.85).aspx
Possibly helpful -> http://www.gamedev.net/topic/504543-antialiased-text-rendering-d3dx9/
possibly helpful ->http://stackoverflow.com/questions/13912482/turn-on-anti-aliasing-in-d3d9
Helpful??->https://msdn.microsoft.com/en-us/library/bb219690(VS.85).aspx
Maybe HelpFul -> http://sofb.developer-works.com/article/24817283/turn+on+anti+aliasing+in+d3d9%3F
Posted By: Kartoffel

Re: Use draw_quad outside the window / render on bmap - 10/01/15 15:25

@^: Antialiasing doesn't affect texture quality. Anisotropic filtering does, but I'm afraid you can't get draw_quad to use a specific texture filtering method (or a custom shader which would allow even more possibilities).
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/01/15 16:51

@Kartoffel - Thanks for bring this out the muddy water of my guessing.
If this is a as you say
Quote:
Antialiasing doesn't affect texture quality


Does that make the quad surface a texture in the nature of engine entities? So can his quad use some kind of manipulation of the mip-map system to blur the texture when he "zooms - out" or rather scales down the quad?

Of course that would not give great results.

@O.P> bmap_rendertarget leads to view.bmap http://www.conitec.net/beta/aview-bmap.htm
which leads to bmap_zbuffer(BMAP*)
http://www.conitec.net/beta/bmap_zbuffer.htm
which leads to render_zbuffer
http://www.conitec.net/beta/render_zbuffer.htm

This chain, as I understand is a way to create a render target larger then the screen and render into a bmap larger then screen. However this my just be my confusion.

Also not sure how you create a engine-ambiguous 2d game using any 3dgs engine commands. Wouldn't you need to write it directly in openGl. also is it even possible to create a web based game and windows game with the same code in any library?

But ok, Have fun!
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/03/15 12:47

hm I'm looking into the possibilities of unity :-)
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/11/15 09:57

I am back. Really used to A8... tongue

I tried with increasing the zbuffer, but its still not working frown
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/11/15 16:38

@Benni003 remind me the current issues you face, please?

Kartoffel told us both that AA and shaders will have no effect.
This is to be a 2d game correct? So then you should need lots of 2d assets. When you scale down the current quad you have 2 issues
1) an untextered black boarder
2) a jagged ugly texture quality.

My solution would be how they would do it in a real game.
1) never scale the quad, clear it, then repaint it with a different texture
2) if you have to zoom in %50, open you digital paint program and modify the %100 texture there. You can use the scaling filters of a 2d art program to create a second texture, or you can actual paint the second texture.
3) You will not be able to quad a giant area one, then move around it and zoom in and out. Not like loading a 3d world. Your world should be constructed of many textures that relate to a grid set-up. You will need to paint and repaint the textured quad(s) to move around on the world and zoom in and out.


You may question this advice, however there is a reason that Zelda and other games work how they do.

Thanks for the fun
Mal
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/11/15 20:46

Ok, thank you Malice. I think I will make to zoom steps and use two different sizes of the graphics for that.
By the way... Anno online have a zoom function, but if I use it, all graphics have a little blur effect.
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/11/15 23:05

Exactly ! I would do it like a the logic of a lod system.

create 4 step graphics for %25, %50, % 75 and %100, then you could still do a bit of scaling also. But no more the %25(+- .25) before changing steps. So if you are at %0 zoom you can scale down the quad to atmost scale = .75. Then change to the next step graphic and scale it up top scale =1.25; . That step can be scale all the way down to scale = .75 before changing the next step image.

This gives you a smoother none stepping zoom and reduces the blur and jaggs

Mal
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/11/15 23:07

As for Anno online, it is a 3d game and also if we could compete with UbiSoft we would be talk on this forum Now.
Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/11/15 23:31

Hi,
you could 'draw_quad' the full map on a not visible bitmap at its pixel to pixel scale and use it as source map in a shader over a view or a 'bmap_process' inside a loop. It would let you use any scale on the visible bitmap with the proper samples. I am afraid anisotropic filter does not work on texture samples but linear interpolation is enough, I guess. It is pretty easy to develop. I can help.

Salud!
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/12/15 00:18

Mal says " listen to txesmi, he's got more brains in one finger than Mal has in his whole head" !!
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/12/15 13:55

@txesmi that sounds good, but I haven't the knowlege to do it smirk
I don't have a view, because I haven't any 3d Level, so I think to use bmap_process is better...
Would be great, if you could give me an example for this.
Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/12/15 22:32

Here you go! wink

main.c
Code:
#include <acknex.h>

// Material skills
#define skPosX       skill5 // X coord relative to the center of the map in map coords (centered on the screen)
#define skPosY       skill6 // Y coord
#define skScale      skill7 // scale of the map
#define skScaleNext  skill8 // needed a map scale smooth transition variable

void main ()
{
	video_mode = 10;
	mouse_mode = 4;
	fps_max = 60;
	wait(1);
	
	BMAP *bmpMap = bmap_create ( "grid.tga" );
	BMAP *bmpScreen = bmap_createblack ( screen_size.x, screen_size.y, 24 );
	PANEL *panScreen = pan_create ( "flags=SHOW", 1 );
	panScreen->bmap = bmpScreen;
	MATERIAL *mtlCamMap = mtl_create ();
	mtlCamMap->skPosX = 0;
	mtlCamMap->skPosY = 0;
	mtlCamMap->skScale = 1;
	mtlCamMap->skScaleNext = mtlCamMap->skScale;
	effect_load ( mtlCamMap, "display_map.fx" );
	
	mtlCamMap->skill4 = floatd ( bmap_height(bmpScreen) * bmap_width(bmpMap), bmap_width(bmpScreen) * bmap_height(bmpMap) );
	var nProp = bmap_width(bmpScreen) / bmap_width(bmpMap);
	
	while ( !key_esc )
	{
		if ( mouse_left )
		{
			mtlCamMap->skPosX += mickey.x / mtlCamMap->skScale;
			mtlCamMap->skPosY += mickey.y / mtlCamMap->skScale;
		}
		if ( mickey.z )
		{
			mtlCamMap->skScaleNext = clamp ( mtlCamMap->skScaleNext + sign(mickey.z), 1, 10 );
		}
		mtlCamMap->skScale += ( mtlCamMap->skScaleNext - mtlCamMap->skScale ) * time_step * 0.5;
		
		mtlCamMap->skill1 = floatd ( mtlCamMap->skPosX, bmap_width(bmpMap) );
		mtlCamMap->skill2 = floatd ( mtlCamMap->skPosY, bmap_height(bmpMap) );
		mtlCamMap->skill3 = floatd ( nProp, mtlCamMap->skScale );
		bmap_process ( bmpScreen, bmpMap, mtlCamMap );
		
		wait(1);
	}
	
	mtl_remove ( mtlCamMap );
	pan_remove ( panScreen );
	bmap_remove ( bmpScreen );
	bmap_remove ( bmpMap );
	
	sys_exit ( NULL );
}



display_map.fx
Code:
float4 vecSkill1;
texture TargetMap;
sampler ColorSampler = sampler_state { Texture = <TargetMap>; MipFilter = Linear; MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; };

float4 PS ( in float2 inTex: TEXCOORD0 ) : COLOR0
{
	inTex.xy -= 0.5f;
	inTex.xy *= vecSkill1.z;
	inTex.y *= vecSkill1.w;
	inTex.xy += 0.5f - vecSkill1.xy;
	return tex2D ( ColorSampler, inTex );
}

technique
{
	pass
	{
		VertexShader = null;
		PixelShader  = compile ps_2_0 PS();
	}
}



Salud!
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/13/15 14:32

Wow, you are great! This is exactly what I was thinking about.
Thank you a lot. laugh
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/13/15 15:13

I have only one Problem. Zooming is good working, but to Have a good Quality I want to draw higher res. Pictures and then integrate a zoom-out function. But the Draw_quad function is not working outside the original Resolution size.
If I soom out, the Pictures out of the original res. size are not drawn, even when the res. of bmpMap is higher...



Code:
bmap_rendertarget(bmpMap,0,1);
draw_quad(bmap_test,vecto(1,500,0),NULL,NULL,NULL,NULL,100,NULL);	
draw_quad(bmap_test,vector(1000,500,0),NULL,NULL,NULL,NULL,100,NULL);	
draw_quad(bmap_test,vector(2000,500,0),NULL,NULL,NULL,NULL,100,NULL);
bmap_rendertarget(NULL,0,0);

Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/13/15 15:49

Glad of been helpful laugh
Maybe you need to encrease the zbuffer meassures. The render target and the source map need to be meassured square of two.

Code:
bmap_zbuffer ( bmap_createblack ( 4096, 2048, 32 ) );



The example is a zoom in, yes. That was the first step: converting the screen coords to map coords.

Now I am adding a fake anisotropy by 3x3 gaussian cubic samples to the shader but I get little inacuracies on the process. I am not sure if it comes from variable inacuracies or from that dx9 offset that has to be applied and I don't master xP

Anyway, this multisample method gives a pretty good zooming out results up to 1:4 scale. For smaller scales it will need more samples.

main.c
Code:
#include <acknex.h>

// Material skills
#define skPosX       skill9  // X coord relative to the center of the map in map coords (centered on the screen)
#define skPosY       skill10 // Y coord
#define skScale      skill11 // scale of the map
#define skScaleNext  skill12 // needed a map scale smooth transition variable

void main ()
{
	video_mode = 10;
	mouse_mode = 4;
	fps_max = 60;
	wait(1);
	
	BMAP *bmpMap = bmap_create ( "grid.tga" );
	BMAP *bmpScreen = bmap_createblack ( screen_size.x, screen_size.y, 24 );
	PANEL *panScreen = pan_create ( "flags=SHOW", 1 );
	panScreen->bmap = bmpScreen;
	MATERIAL *mtlCamMap = mtl_create ();
	mtlCamMap->skPosX = 0;
	mtlCamMap->skPosY = 0;
	mtlCamMap->skScale = 1;
	mtlCamMap->skScaleNext = mtlCamMap->skScale;
	effect_load ( mtlCamMap, "display_map.fx" );
	
	mtlCamMap->skill4 = floatd ( bmap_height(bmpScreen) * bmap_width(bmpMap), bmap_width(bmpScreen) * bmap_height(bmpMap) );
	var nProp = bmap_width(bmpScreen) / bmap_width(bmpMap);
	
	while ( !key_esc )
	{
		if ( mouse_left )
		{
			mtlCamMap->skPosX += mickey.x / mtlCamMap->skScale;
			mtlCamMap->skPosY += mickey.y / mtlCamMap->skScale;
		}
		if ( mickey.z > 0 )
		{
			mtlCamMap->skScaleNext = minv ( mtlCamMap->skScaleNext * 1.414, 2 ); // 1.414 ~= sqrt(2)
		}
		if ( mickey.z < 0 )
		{
			mtlCamMap->skScaleNext = maxv ( mtlCamMap->skScaleNext / 1.414, 0.25 );
		}
		mtlCamMap->skScale += ( mtlCamMap->skScaleNext - mtlCamMap->skScale ) * time_step * 0.5;
		
		mtlCamMap->skill1 = floatd ( mtlCamMap->skPosX, bmap_width(bmpMap) );
		mtlCamMap->skill2 = floatd ( mtlCamMap->skPosY, bmap_height(bmpMap) );
		mtlCamMap->skill3 = floatd ( nProp, mtlCamMap->skScale );
		mtlCamMap->skill5 = floatd ( 0.5, bmap_width(bmpMap) * mtlCamMap->skScale );
		mtlCamMap->skill6 = floatd ( 0.5, bmap_height(bmpMap) * mtlCamMap->skScale );
		bmap_process ( bmpScreen, bmpMap, mtlCamMap );
		
		wait(1);
	}
	
	mtl_remove ( mtlCamMap );
	pan_remove ( panScreen );
	bmap_remove ( bmpScreen );
	bmap_remove ( bmpMap );
	
	sys_exit ( NULL );
}



display_map.fx
Code:
float4 vecSkill1;
float4 vecSkill5;
texture TargetMap;
sampler ColorSampler = sampler_state { Texture = <TargetMap>; MipFilter = Linear; MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; };

float2 fOffset3x3[9] = { -1,-1, 0,-1, 1,-1, -1,0, 0,0, 1,0, -1,1, 0,1, 1,1 };
float fGauss3x3[9] = { 0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625 };

float4 PS ( in float2 inTex: TEXCOORD0 ) : COLOR0
{
	inTex.xy -= 0.5f;
	inTex.xy *= vecSkill1.z;
	inTex.y *= vecSkill1.w;
	inTex.xy += 0.5f - vecSkill1.xy;
	float4 Color = 0;
	for ( int i=0; i<9; i+=1 )
		Color.rgb += tex2D ( ColorSampler, inTex + fOffset3x3[i] * vecSkill5.xy ).rgb * fGauss3x3[i];
	Color.a = 1.0f;
	return Color;
}

technique
{
	pass
	{
		VertexShader = null;
		PixelShader  = compile ps_2_0 PS();
	}
}



Salud!
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/13/15 17:01

It Looks really good, but still the Problem with draw_quad() outside the original Screen resolution. I've also tried with increasing the zbuffer size, as you sayed, but it's still not working. The graphics are always cutted at the end Point .. smirk
Posted By: Superku

Re: Use draw_quad outside the window / render on bmap - 10/13/15 17:19

So you are using bmap_rendertarget(). Have you called bmap_zbuffer(), too?
http://www.conitec.net/beta/bmap_zbuffer.htm
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/13/15 17:27

@Superku - I sent him that way a few post back. All be it, I'm adding much confusion to the thread...
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/13/15 17:31

@Superku: Of course, but just the first three pics are drawn. I zoomed out with the code from txesmi to see it.
bmpMap have also the size 2048x2048. The screen size.x is 1440px

Code:
bmap_zbuffer(bmap_createblack(2048,2048,32));

while(1)
{
bmap_rendertarget(bmpMap,0,0);
		
		draw_quad(tt,vector(100,20,0),NULL,NULL,NULL,NULL,100,NULL);	
		draw_quad(tt,vector(500,20,0),NULL,NULL,NULL,NULL,100,NULL);	
		draw_quad(tt,vector(1000,20,0),NULL,NULL,NULL,NULL,100,NULL);	
		draw_quad(tt,vector(1500,20,0),NULL,NULL,NULL,NULL,100,NULL);	
		draw_quad(tt,vector(2000,20,0),NULL,NULL,NULL,NULL,100,NULL);	
		
bmap_rendertarget(NULL,0,0);
wait(1);
}



Does anyone have a solution for this problem? smirk
Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/14/15 11:18

Hi,
It does not happen on my computer.
The engine loads some functionalities when a level is loaded. Try loading an empty level... just guessing.

Anuway, I just realized there are other troubles. The 1:1 scale is not pixel to pixel on big maps but the map scaled to screen width...

I will revise it.
txes
Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/14/15 13:39

Cleaner version but same acuracy problem frown

main.c
Code:
#include <acknex.h>

// Material skills
#define skPosX       skill17 // X coord in map coords relative to the center of the map (centered on the screen)
#define skPosY       skill18 // Y coord...
#define skScale      skill19 // scale of the map
#define skScaleNext  skill20 // needed a map scale smooth transition variable

void main ()
{
	video_mode = 10;
	mouse_mode = 4;
	fps_max = 60;
	wait(1);
	
	BMAP *bmpMap = bmap_create ( "grid.tga" );
	BMAP *bmpScreen = bmap_createblack ( screen_size.x, screen_size.y, 24 );
	PANEL *panScreen = pan_create ( "flags=SHOW", 1 );
	panScreen->bmap = bmpScreen;
	MATERIAL *mtlCamMap = mtl_create ();
	mtlCamMap->skPosX = 0;
	mtlCamMap->skPosY = 0;
	mtlCamMap->skScale = 1;
	mtlCamMap->skScaleNext = mtlCamMap->skScale;
	
	mtlCamMap->skill1 = floatv ( bmap_width(bmpScreen) );
	mtlCamMap->skill2 = floatv ( bmap_height(bmpScreen) );
	mtlCamMap->skill3 = floatd ( 1, bmap_width(bmpMap) );
	mtlCamMap->skill4 = floatd ( 1, bmap_height(bmpMap) );
	effect_load ( mtlCamMap, "display_map.fx" );
	
	while ( !key_esc )
	{
		if ( mouse_left )
		{
			mtlCamMap->skPosX -= mickey.x / mtlCamMap->skScale;
			mtlCamMap->skPosY -= mickey.y / mtlCamMap->skScale;
		}
		if ( mickey.z > 0 )
		{
			mtlCamMap->skScaleNext = minv ( mtlCamMap->skScaleNext * 1.414, 2 ); // 1.414 ~= sqrt(2)
		}
		if ( mickey.z < 0 )
		{
			mtlCamMap->skScaleNext = maxv ( mtlCamMap->skScaleNext / 1.414, 0.25 );
		}
		var nTemp = ( mtlCamMap->skScaleNext - mtlCamMap->skScale ) * time_step * 0.75;
		if ( nTemp )
			mtlCamMap->skScale += nTemp;
		else
			mtlCamMap->skScale = mtlCamMap->skScaleNext;
		
		mtlCamMap->skill5 = floatv ( mtlCamMap->skPosX );
		mtlCamMap->skill6 = floatv ( mtlCamMap->skPosY );
		mtlCamMap->skill7 = floatd ( 1, mtlCamMap->skScale );
		bmap_process ( bmpScreen, bmpMap, mtlCamMap );
		
		wait(1);
	}
	
	mtl_remove ( mtlCamMap );
	pan_remove ( panScreen );
	bmap_remove ( bmpScreen );
	bmap_remove ( bmpMap );
	
	sys_exit ( NULL );
}



display_map.fx
Code:
float4 vecSkill1;
float4 vecSkill5;
texture TargetMap;
sampler ColorSampler = sampler_state { 
	Texture=<TargetMap>; 
	MipFilter=Linear; MinFilter=Linear; MagFilter=Linear; 
	AddressU=Border; AddressV=Border; 
	BorderColor=0xFF000000; }; // ARGB format

float2 fOffset3x3[9] = { -0.5,-0.5, 0,-0.5, 0.5,-0.5, -0.5,0, 0,0, 0.5,0, -0.5,0.5, 0,0.5, 0.5,0.5 };
float fGauss3x3[9] = { 0.0625, 0.125, 0.0625, 0.125, 0.25, 0.125, 0.0625, 0.125, 0.0625 };

float4 PS ( in float2 inTex: TEXCOORD0 ) : COLOR0
{
	inTex.xy -= 0.5f;
	inTex.xy *= vecSkill1.xy;
	inTex.xy *= vecSkill5.z;
	inTex.xy += vecSkill5.xy;
	inTex.xy *= vecSkill1.zw;
	inTex.xy += 0.5f;
	float4 Color = 0;
	for ( int i=0; i<9; i+=1 )
		Color.rgb += tex2D ( ColorSampler, inTex + fOffset3x3[i] * vecSkill1.zw * vecSkill5.z ).rgb * fGauss3x3[i];
	Color.a = 1.0f;
	return Color;
}

technique
{
	pass
	{
		VertexShader = null;
		PixelShader  = compile ps_2_0 PS();
	}
}



Salud!
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/14/15 14:36

Originally Posted By: txesmi
Hi,
It does not happen on my computer.
The engine loads some functionalities when a level is loaded. Try loading an empty level... just guessing.
txes


I've tried also with loading a level before, but not working.
Here is the main.c Code I'm using to try it. I have 5 draw_quad calls, but just the first three of them are drawn. Did I something wrong?
Could you try it on your pc? Size.x is 1440px

Code:
#include <acknex.h>

// Material skills
#define skPosX       skill9  // X coord relative to the center of the map in map coords (centered on the screen)
#define skPosY       skill10 // Y coord
#define skScale      skill11 // scale of the map
#define skScaleNext  skill12 // needed a map scale smooth transition variable

void main ()
{
	video_mode = 10;
	mouse_mode = 4;
	fps_max = 60;

	wait(1);

	BMAP *bmpMap = bmap_createblack(1920,1200,32);
	
	BMAP *bmpScreen = bmap_createblack(1920,1200,24);
	PANEL *panScreen = pan_create ( "flags=SHOW", 1 );
	panScreen->bmap = bmpScreen;
	MATERIAL *mtlCamMap = mtl_create ();
	mtlCamMap->skPosX = 0;
	mtlCamMap->skPosY = 0;
	mtlCamMap->skScale = 1;
	mtlCamMap->skScaleNext = mtlCamMap->skScale;
	effect_load ( mtlCamMap, "display_map.fx" );
	
	mtlCamMap->skill4 = floatd ( bmap_height(bmpScreen) * bmap_width(bmpMap), bmap_width(bmpScreen) * bmap_height(bmpMap) );
	var nProp = bmap_width(bmpScreen) / bmap_width(bmpMap);

	var x=100;
	
	bmap_zbuffer(bmap_createblack(2048,2048,32));
	
	while ( !key_esc )
	{
		//------------

		bmap_rendertarget(bmpMap,0,0);
		
		draw_quad(NULL,vector(-50,20,0),NULL,vector(100,100,0),NULL,vector(200,200,200),100,NULL);	
		draw_quad(NULL,vector(500,20,0),NULL,vector(100,100,0),NULL,vector(200,200,200),100,NULL);	
		draw_quad(NULL,vector(1000,20,0),NULL,vector(100,100,0),NULL,vector(200,200,200),100,NULL);	
		draw_quad(NULL,vector(1450,20,0),NULL,vector(100,100,0),NULL,vector(200,200,200),100,NULL);	
		draw_quad(NULL,vector(2000,20,0),NULL,vector(100,100,0),NULL,vector(200,200,200),100,NULL);	
		
		bmap_rendertarget(NULL,0,0);
		
		//----------
		
		if ( mouse_left )
		{
			mtlCamMap->skPosX += mickey.x / mtlCamMap->skScale;
			mtlCamMap->skPosY += mickey.y / mtlCamMap->skScale;
		}
		
		if ( mickey.z )
		{
			mtlCamMap->skScaleNext = clamp ( mtlCamMap->skScaleNext + sign(mickey.z),0.001, 1000 );
		}
		mtlCamMap->skScale += ( mtlCamMap->skScaleNext - mtlCamMap->skScale ) * time_step * 0.5;
		
		mtlCamMap->skill1 = floatd ( mtlCamMap->skPosX, bmap_width(bmpMap) );
		mtlCamMap->skill2 = floatd ( mtlCamMap->skPosY, bmap_height(bmpMap) );
		mtlCamMap->skill3 = floatd ( nProp, mtlCamMap->skScale );
		mtlCamMap->skill5 = floatd ( 0.5, bmap_width(bmpMap) * mtlCamMap->skScale );
		mtlCamMap->skill6 = floatd ( 0.5, bmap_height(bmpMap) * mtlCamMap->skScale );
		
		bmap_process ( bmpScreen, bmpMap, mtlCamMap );
		
		
		wait(1);
	}
	
	mtl_remove ( mtlCamMap );
	pan_remove ( panScreen );
	bmap_remove ( bmpScreen );
	bmap_remove ( bmpMap );
	
	sys_exit ( NULL );
}

Posted By: txesmi

Re: Use draw_quad outside the window / render on bmap - 10/14/15 15:18

It certainly happens in my computer too shocked sorry

Tried to encrease the camera size on an empty level but it does not modify those draw_quad limits frown

The only workaround I can imagine is cutting the map in pieces, but pretty unruly...
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/14/15 15:50

Hm I hope there is an other possibility... Maybe jcl knows something else? smirk
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/14/15 16:47


You are rendering into view.bmap , this bmap is screen size.
bmap_rendertarget
Quote:
Render target 0 can only be set when the view has no own render target (view.bmap), and can be switched off through bmap_rendertarget(NULL,0,0) for resuming normal screen rendering.

Could your error be the num var,
bmap_rendertarget(BmpMap,1,0);
NOT
bmap_rendertarget(BmpMap,0,0);

Edit more view.bmap
Quote:
The bitmap is automatically converted to a render target format and not accessible anymore for pixel operations. The view's pos_x/pos_y and size_x/size_y parameters define an offset and target area on the bmap. A7.10 For rendering into an environment map, set the view pos_x parameter to the pixel position of the beginning of the face you want to render into.
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/14/15 17:10

If I set bmap_rendertarget(BmpMap,1,0); nothing is drawn.
Posted By: Anonymous

Re: Use draw_quad outside the window / render on bmap - 10/14/15 18:11

@Benni003, Ok well I guess I'm no help. Good luck.

One question - I do not know if it work this way - Instead of rendering to the bmpMap, can you render to bmap_zbuffer.

bmap_rendertarget(render_zbuffer,0,0);

Yes I have no clue and am now just guessing. Sorry I'm not testing this stuff, I don't have the engine currently installed
Mal


Quote:
The LPDIRECT3DSURFACE9 pointer to the created z buffer is available through the render_zbuffer variable.


And the BMAP struct takes a LPDIRECT3DTEXTURE9

Info for moving LPDIRECT3DSURFACE9 into LPDIRECT3DTEXTURE9

http://stackoverflow.com/questions/14279843/directx9-surface-to-texture

And YES I'm just wild fishing
Posted By: Dico

Re: Use draw_quad outside the window / render on bmap - 10/14/15 19:53

i have an idea , what about if you split your map into 6 maps or more and in every part take a render target from it then in final add all parts to one .
and remove the olds parts.
Posted By: Dico

Re: Use draw_quad outside the window / render on bmap - 10/14/15 19:55

and for render target i think it not work if you set it bigger than hwnd (dx9 limitation). im not sure but maybe im wrong
Posted By: Wjbender

Re: Use draw_quad outside the window / render on bmap - 10/14/15 20:09

set your image as a texture on a plane or flat terrain... now use the camera or
the z offset of the model as the zoom ....

the added advantage is also , you can change the detail/image size depending on the zoom/z-offset as you need
Posted By: Benni003

Re: Use draw_quad outside the window / render on bmap - 10/16/15 13:05

Not so easy with this rendering problem. I think I will use the zoomin function (up to 25%) and that was it. Then I don't have to think about this problem and the detail is also still good. Thank you all
© 2024 lite-C Forums