Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/08/26 22:41
Stooq now requires an API key
by VHX. 06/08/26 20:14
ZorroGPT
by TipmyPip. 06/06/26 12:36
Zorro 3.01 recoded MMI function issue
by TipmyPip. 06/04/26 05:44
SGT_FW
by Aku_Aku. 05/31/26 11:05
Issues resuming trades on Demo account
by Martin_HH. 05/22/26 13:31
XTB
by pr0logic. 05/18/26 12:27
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (TipmyPip, Grant, 2 invisible), 3,454 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Seraphinang, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
TargetMap seems to be empty #422853
05/18/13 20:33
05/18/13 20:33
Joined: Apr 2012
Posts: 14
I
InfinitlyMe Offline OP
Newbie
InfinitlyMe  Offline OP
Newbie
I

Joined: Apr 2012
Posts: 14
The model is skinned and texture-coordinates are valid between 0 and 1. If i change in ps to
Code:
Color =  Color = float4(input.TexCoords.x,input.TexCoords.y,1,1);

i get a green/red ball. that means the texcoords are as they should be. but the tex2D returns always black.

without vertexshader it works as expected. but why? what i´m doing wrong?

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

ENTITY* eEarth;
MATERIAL* matEarth = {
	effect="Earth.fx";
}

...

void main() {
	level_load("");
	wait(2);
	
	
	eEarth = ent_create("Earth.mdl",vector(0,0,0),planet);
	eEarth.material = matEarth;
	
	
	vec_set(camera.x,vector(-7500,0,2500));
	
	camera.tilt=-20;
}



Code:
sampler2D smpScreen = sampler_state
{
	Texture = <TargetMap>;
	
	MinFilter	= linear;
	MagFilter	= linear;
	MipFilter	= linear;
	
	AddressU		= Wrap;
	AddressV		= Wrap;
};
 
 struct Out
 {
    float4 Position : POSITION;
     float4 Normal : TEXCOORD1;
     float2 TexCoords : TEXCOORD0;
 };
 
 Out vs (float4 pos : POSITION, float4 n : NORMAL, float2 tex : TEXCOORD0)
 {
 	Out output;
 	output.Position =mul(pos,matWorldViewProj);
 	output.TexCoords = tex;
 	output.Normal = n;
 	
 	return output;
 }

float4 ps(Out input) : COLOR
{
  	float4 Color;

  	Color =  tex2D(smpScreen,input.TexCoords);
  	
  	return Color;
}





technique tech_00
{
	pass pass_00
	{
		VertexShader = compile vs_3_0 vs();
		PixelShader = compile ps_3_0 ps();
	}
}


Re: TargetMap seems to be empty [Re: InfinitlyMe] #422854
05/18/13 20:44
05/18/13 20:44
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
If I'm not mistaken TargetMap is a pointer that points to the render target of the previous stage in a view chain and is not suitable for object shaders. You are looking for entSkin1 (see manual).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: TargetMap seems to be empty [Re: Superku] #422886
05/19/13 17:31
05/19/13 17:31
Joined: Apr 2012
Posts: 14
I
InfinitlyMe Offline OP
Newbie
InfinitlyMe  Offline OP
Newbie
I

Joined: Apr 2012
Posts: 14
Oh, thank you very much. I saw Slins Shader Tutorial and he uses everytime TargetMap. But he also wrote Postprocessing-Shaders.

May i annoy with another issue? I solved, thanks to you, my problem with the object-shader, but now i try a postprocessing effect. i wrote this:

Code:
texture TargetMap;

sampler2D smpScreen = sampler_state
{
	Texture = <TargetMap>;
	
	MinFilter	= linear;
	MagFilter	= linear;
	MipFilter	= linear;
	
	AddressU		= Wrap;
	AddressV		= Wrap;
};

float4 Shader(float2 tex : TEXCOORD0) : COLOR
{
  	float4 Color=tex2D(smpScreen, tex);
  	return Color;
}



technique tech_00
{
	pass pass_00
	{
		VertexShader = null;
		PixelShader = compile ps_3_0 Shader();
	}
}



and added the effect with PP_Add (part of Slins PP_Helper.c)

Code:
MATERIAL* matBlur = {
	effect="blur.fx";
}

void main() {
...

PP_Add(matBlur,camera,NULL);
...
}



The result is that the TargetMap seems to remember the drawing of previous frames:


What is wrong (the planet and its moon moves around the sun; all of them have earth-skin yet)? I just want to have the rendered camera screen in this postprocessing shader. why it is not cleared after the last rendering?

ps: here is PP_Add, if you need it:
Code:
VIEW* PP_Add(MATERIAL* Material,VIEW* View,BMAP* bmap)
{
	//find the last view of "View"s effectchain and store its pointer
	PP_Temp_View = View;
	while(PP_Temp_View.stage != NULL)
	{
		PP_Temp_View = PP_Temp_View.stage;
	}
	
	//create a new view as the stored views stage
	PP_Temp_View.stage = view_create(0);
	set(PP_Temp_View.stage,PROCESS_TARGET);
	
	//assign "Material" to the just created view
	PP_Temp_View = PP_Temp_View.stage;
	PP_Temp_View.material = Material;
	
	//if a bmap is given, render the view into it
	if(bmap != NULL)
	{
		PP_Temp_View.bmap = bmap;
	}
	
	//return the pointer to the new view
	return(PP_Temp_View);
}


Re: TargetMap seems to be empty [Re: InfinitlyMe] #422890
05/19/13 17:57
05/19/13 17:57
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Have you set the sky_color to 0 (,0,0)? Then the background won't be cleared and the result will be what is visible in your screenshot. Set it to COLOR_BLACK (1,1,1) instead.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: TargetMap seems to be empty [Re: Superku] #422891
05/19/13 18:03
05/19/13 18:03
Joined: Apr 2012
Posts: 14
I
InfinitlyMe Offline OP
Newbie
InfinitlyMe  Offline OP
Newbie
I

Joined: Apr 2012
Posts: 14
yes... i did.
thank you again


Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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