Gamestudio Links
Zorro Links
Newest Posts
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
folder management functions
by 7th_zorro. 04/15/24 10:10
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
SGT_FW
by Aku_Aku. 04/10/24 16:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, Quad), 373 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
simple tile effect ? #127870
05/03/07 17:36
05/03/07 17:36
Joined: Jan 2002
Posts: 81
Right Here
H
Hades2 Offline OP
Junior Member
Hades2  Offline OP
Junior Member
H

Joined: Jan 2002
Posts: 81
Right Here
Hello,

I have to admit that I'm not so good with shaders, but perhaps some good soul can help me on this issue.

It's quite simple, I'm doing a Golf game, I made a function to place the grid, that stays on the ground to show better the terrain curves.

The function is okay, I have transformed a terrain to mdl, and then I adjust each mdl vertex according to the ground height.

My problem is the texture, I'm using a wireframe shader, but then the diagonals are visible, and this is undesirable.

I'm looking for a shader where I can use a transparent skin, and simple define it's texture scale to tile it as I want. Perhaps it's more easy than I think, but some tries I made didn't work as I wish.

Help is welcome.

thanks.

Re: simple tile effect ? [Re: Hades2] #127871
05/03/07 20:22
05/03/07 20:22
Joined: May 2005
Posts: 155
C:\Program files\GStudio6
alphaindigo Offline
Member
alphaindigo  Offline
Member

Joined: May 2005
Posts: 155
C:\Program files\GStudio6
you may not even need a shader at all , try using a grid with brg 0,0,0 in the cntre of the squares and then use my.overlay = on;


beware the sock! - tLempoary...
Re: simple tile effect ? [Re: alphaindigo] #127872
05/03/07 20:44
05/03/07 20:44
Joined: Jan 2002
Posts: 81
Right Here
H
Hades2 Offline OP
Junior Member
Hades2  Offline OP
Junior Member
H

Joined: Jan 2002
Posts: 81
Right Here
of course I thought on this using a grid texture, but I would need a very big texture to have the grid I want, so if possible, a simple tile function should be very better.

That's what I have:



thanks

Re: simple tile effect ? [Re: Hades2] #127873
05/03/07 21:00
05/03/07 21:00
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
you could draw the lines manually using vec_for_vertex and draw_line commands :/

Re: simple tile effect ? [Re: lostclimate] #127874
05/03/07 21:22
05/03/07 21:22
Joined: Jan 2002
Posts: 81
Right Here
H
Hades2 Offline OP
Junior Member
Hades2  Offline OP
Junior Member
H

Joined: Jan 2002
Posts: 81
Right Here
Can be a solution. But, I still think that a simple shader could be used easily. The problem is that I don't know to much about shaders..

I tried to adapt some shaders, as the multi-texture terrain shader, but I had no success.

I think the scheme is simple, like two textures, first black, to be transparent, second a simple grid - small, tiled according to the scale set (as the multi-texture terrain).

The point is, how I translate this sentence to a shader code...

Anyway, thanks for helping.

Re: simple tile effect ? [Re: Hades2] #127875
05/04/07 10:25
05/04/07 10:25
Joined: Oct 2002
Posts: 806
Zapan@work Offline
User
Zapan@work  Offline
User

Joined: Oct 2002
Posts: 806
With this material you can display the wireframe of the assignt model:
Code:
  
material mat_modelWire
{
effect = "
DWORD wfcolor = 0xFFFEFFFF;

technique wireframe
{
pass p0
{

TextureFactor = <wfcolor>;
CullMode = None;
FillMode = Wireframe;
ColorOp[0] = SelectArg1;
ColorArg1[0] = TFactor;
}
}";
}



Re: simple tile effect ? [Re: Zapan@work] #127876
05/04/07 12:01
05/04/07 12:01
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
thats exactly what he doesnot want.

but , you could try to overlay a a grid texture using the multitexture shader and a grid texture as a detailmap

Re: simple tile effect ? [Re: ello] #127877
05/04/07 15:17
05/04/07 15:17
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
thats what i was thinking but he'll have a lot of pixel/texel math to do

Re: simple tile effect ? [Re: lostclimate] #127878
05/04/07 15:48
05/04/07 15:48
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
This should be really easy to do. Just use the "wireframe" overlay's alpha channel for blending.

ex: (HLSL pixel shader)

float4 inColor = tex2D(mapSkin1, In.tex);
float4 inGrid = tex2D(mapSkin2, In.Tex * oScale);
float4 outColor;
outColor.rgb = lerp(inColor.rgb, inGrid.rgb, inGrid.a);
outColor.a = inColor.a;

Of course some of the variable names will need to be renamed, but this is the concept for it...


xXxGuitar511
- Programmer
Re: simple tile effect ? [Re: xXxGuitar511] #127879
05/07/07 14:04
05/07/07 14:04
Joined: Jan 2002
Posts: 81
Right Here
H
Hades2 Offline OP
Junior Member
Hades2  Offline OP
Junior Member
H

Joined: Jan 2002
Posts: 81
Right Here
Thanks for all help.

I'm almost having what I want. I used some shaders examples found in the Forum, and I made some tries. Here is what I got:



here is the shader I'm using - two skins, the second is a simple grid with alpha - TGA.

>>
//SHADER - teste

//this is the only matrix you need for this shader.. world*view*projection
float4x4 matWorldViewProj;
float4 Color;

//here is the vertex shader outputstruct
struct VS_OUTPUT {
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};

//simple vertex shader calculates the vertex position and tex coords
VS_OUTPUT mainVS( float4 Pos : POSITION, float2 Tex : TEXCOORD0 ) {
VS_OUTPUT Out = (VS_OUTPUT) 0;
Out.Pos = mul(Pos,matWorldViewProj );
Out.Tex = Tex;
return Out;
}

texture entSkin1; //define the sampler for the entity skin
texture entSkin2; //define the sampler for the entity skin

sampler basemap = sampler_state {
Texture = <entSkin1>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = clamp;
AddressV = clamp;
};
sampler detailmap = sampler_state
{
Texture = <entSkin2>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
AddressU = wrap; //you want it wrap because it will be scaled smaller
AddressV = wrap;
};

// Simple pixel shader samples the entity skin according to Tex.xy coords
//float4 mainPS(float2 Tex: TEXCOORD0) : COLOR {
// Color = tex2D( basemap, Tex.xy);
// return Color;
// }
// pixel shader that does detail mapping
float4 mainPS(float2 Tex: TEXCOORD0) : COLOR
{
Color = //sample base color
tex2D( basemap, Tex.xy) * //multiply with the detail texture and scale the texture coords
tex2D( detailmap,(Tex.xy * 60));
return Color;

//float4 inColor = tex2D(mapSkin1, In.tex);
//float4 inGrid = tex2D(mapSkin2, In.Tex * oScale);
//float4 outColor;
//outColor.rgb = lerp(inColor.rgb, inGrid.rgb, inGrid.a);
//outColor.a = inColor.a;
}

technique blur {
pass Object {
//alphablendenable=false;
ZENABLE = TRUE;
//VertexShader = compile vs_1_1 mainVS();
VertexShader = NULL;
PixelShader = compile ps_2_0 mainPS();
}
}
>>

The last tip I'm looking for is how to let the second texture, the grid, more visible indifferent to the distance.

Anyway, it's much better now - thanks.

Page 1 of 2 1 2

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