Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,031 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
More than 4 entskins #467977
09/12/17 02:35
09/12/17 02:35
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hello! Was wondering if anyone has any ideas for sampling more than 4 internal textures of a model in a shader. The manual clearly states that only entskin1...entskin4 can be declared in the shader.

I can very easily just use mtlSkin1-4, which are "external" textures outside of the model, such as a sky cube, which is ok to declare and use. But I am trying to cram one more map into my shader, without having to write a new shader that points to a new external map.

Here is my skin list within the model:

Skin texture 1: Diffuse and Alpha...RGB and alpha are used
Skin texture 2: Rim lighting...RGB is used, Alpha isnt used by shader
Skin texture 3: ShinyMap...RGB is used, Alpha is used
Skin texture 4: Normal Map...RGB is used, Alpha isnt used by shader

Finally, I want to use a 5th texture, a sub surface map for some fake Subsurface scattering. This map is RGB, alpha isnt used. So as you can see, if I want to make multiple characters, each with their own subsurface map and subsurface color, I would need to make a different shader for each subsurface map.

I guess I could use vecSkill and perform some if statements and link the single shader to different SSS maps depending on the character, but maybe theres another clever way. Maybe I could use the unused Alpha channels of certain textures and use these as RGB values for the SSS map.

Curious if anyone else has any ideas.

Re: More than 4 entskins [Re: jumpman] #467984
09/12/17 05:09
09/12/17 05:09
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
You could use a single bitmap as texture atlas with four half-resolution effect bitmaps, if you don't mind the resolution lost.

Re: More than 4 entskins [Re: txesmi] #467985
09/12/17 05:27
09/12/17 05:27
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
how does that work?

does one of the models skins need it's UV to be wrapped differently? Is this done in a shader, or in the model file itself?

Re: More than 4 entskins [Re: jumpman] #467988
09/12/17 10:08
09/12/17 10:08
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
you can perform both depending on the best choice for your needs.

You could save diffuse and normals in a image near to this:

but without that ugly vertical white stripe in the middle xP

And build the UVmap using the left half of the image, so the normalmap coord into the shader will be:
Code:
float2 nCoor = inTex;
nCoor.x += 0.5f;



But as I suggested in my previous post, you could also use an effectmap, on same, twice or whatever resolution of the colormap:
Code:
float4 Color = tex2D ( sDiff, inTex );
float2 UpLeftQuarter = inTex * 0.5f;
float4 Normal = tex2D ( sEffects, UpLeftQuarter );
float2 UpRightQuarter = float2 ( UpLeftQuarter.x + 0.5f, UpLeftQuarter.y );
float4 Specular = tex2D ( sEffects, UpRightQuarter );
// and so...


Re: More than 4 entskins [Re: txesmi] #467994
09/12/17 14:26
09/12/17 14:26
Joined: Jun 2010
Posts: 212
tagimbul Offline
Member
tagimbul  Offline
Member

Joined: Jun 2010
Posts: 212
you can use BMAP's directly from lite_c

lite_c:
Code:
BAMP* my_image = "test.png";



shader:
Code:
texture my_image_bmap;

sampler sTex = sampler_state
{
	Texture = <my_image_bmap>;
}



if you make global bmap's or arrays you can use this thing in shader if you add a _bmap or _var to the name of your objekt

Last edited by tagimbul; 09/12/17 14:29.

meine website mit 3dgs sachen =) //noch nicht ganz umgebaut ^^"
http://flashbreaker.com/home.html
und mein YT channel mit diversen game entwicklungs videos, vor allem shader zeugs
https://www.youtube.com/user/tagimbul/videos
Re: More than 4 entskins [Re: txesmi] #467999
09/12/17 16:01
09/12/17 16:01
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
wow...that is very clever thank you, I didnt know you could offset a texture lookup position!

I half implemented the first solution, until I saw you cant have different UV layouts for each skin. In skin1, which is the color/diffuse, the UV map is spread out all over it. In skin2, which has the "double texture" dimension(rim light and SSS, 128 x 256), I cannot move the UV to the left without effecting every other skin. I would need to move the UV to the left on every skin correct? All skins must have the same ratio in this case...which means the Color map in skin1, would need a blank spot to the right.

Does having a dedicated effect map in an entity skin overcome this? I dont see how it can, since model skins still need UV layouts in the skins.

Re: More than 4 entskins [Re: tagimbul] #468000
09/12/17 17:15
09/12/17 17:15
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hi tagimbul,

that changes the texture globally for that material. What I want is to have a way to use a 5th entity texture, which can be different for every model....but all using the same FX file.

Re: More than 4 entskins [Re: jumpman] #468001
09/12/17 17:23
09/12/17 17:23
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
UV layouts are not skin related but mesh related. Each vertex has two sets of UV coords available. You will need to set both UV set in the model, you know.
Code:
in float2 inTex1 : TEXCOORD0
in float2 inTex2 : TEXCOORD1



Those texture atlas examples are just examples. I did not think to much about them.

In the first example, you will probably prefer to mantain the model UV coords filling the texture, as they usually are, and simply scale them for your needs.
Code:
float2 diffCoor = float2 ( inTex.x * 0.5f, inTex.y );
float2 normalCoor = float2 ( diffCoor.x + 0.5f, inTex.y );



I was just trying to explain that you can use the models UV coords for your advantage but it does not needed to be that way. Blank spots should not be in the planning, true wink

Re: More than 4 entskins [Re: txesmi] #468007
09/12/17 20:14
09/12/17 20:14
Joined: Jun 2010
Posts: 212
tagimbul Offline
Member
tagimbul  Offline
Member

Joined: Jun 2010
Posts: 212
i have a idea =)
your 4 textures:
RGBA, RGB, RGBA, RGB
size:
512x512

combine
RGBA + RGBA
RGB + RGB

texture 1 with 2:
1024x512
texture 3 with 4:
1024x512

and in shader scale in tex2D, X with 0.5

and if you want use mip's

all 4 texture in one:
1024x1024

and scale in tex2D Y with 0.5 too

(i think mips need same x and y size. right?)

edit:

ent texture 1 = 512x512 your sub surface map with the UV
ent texture 2 = texture 1+2 1024x512
ent texture 3 = texture 3+4 1024x512
ent texture 4 = free

positive:
its work ^^
negativ:
reading biger texture / need more performance

i dont know.. what is faster? read 2 texture in 512x512 or one texture in 1024x512?...

edit2:

or:

ent texture 1 = 512x512 model color texture
ent texture 2 = 1024x512 texture 2+3
ent texture 3 = 1024x512 texture 4+5
ent texture 4 = free

Last edited by tagimbul; 09/12/17 20:32.

meine website mit 3dgs sachen =) //noch nicht ganz umgebaut ^^"
http://flashbreaker.com/home.html
und mein YT channel mit diversen game entwicklungs videos, vor allem shader zeugs
https://www.youtube.com/user/tagimbul/videos
Re: More than 4 entskins [Re: tagimbul] #468056
09/15/17 00:13
09/15/17 00:13
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hi everyone, Ive used Txesmi's method, and it seems to work so far!!! Thank you for all your input everyone, you all are a clever bunch of game developers laugh


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