Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Complex Texture Blending #400358
04/29/12 13:57
04/29/12 13:57
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline OP
Senior Expert
Pappenheimer  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I take a 'journey' through the levels of Prince of Persia,
although I finished the game months ago,
because of the beauty of the levels
- and because I'm still clueless about
how they did the texture blending
which allows a sheer endless variety.

It must be a combination of blending of textures
as we know it from the terrain shaders of Acknex
and decals and even blending of textures
that got an alpha channel of its own additionally
- BUT -
how do they use such a huge amount of these
- even if you look into the landscape
you still see the decals far away.

Main example of the decals are the scratches on the walls that show you where your hero can run along.

Here are some screenshots from my 'journeys'
because I can't find any in the net that show these blendings properly.

The scratches close to the camera and far away on the walls:
http://puppenheim.org/PrinceOfPersia21.jpg

A combination of texture blending and the blending of sort of decals (the roots):
http://puppenheim.org/PrinceOfPersia38.jpg
http://puppenheim.org/PrinceOfPersia39.jpg
http://puppenheim.org/PrinceOfPersia80.jpg

Blending of grid(you can see through the gaps of the grid) and vegetation texture:
http://puppenheim.org/PrinceOfPersia81.jpg

How can we achieve something like this with Acknex while keeping a decent framerate?

Re: Complex Texture Blending [Re: Pappenheimer] #400359
04/29/12 14:16
04/29/12 14:16
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline OP
Senior Expert
Pappenheimer  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Maybe, the following comparison of low and high grafics settings
helps to get an idea how they did the blending?

What strucks me most is the shape of the blended sand.

http://puppenheim.org/PrinceOfPersia86.jpg
http://puppenheim.org/PrinceOfPersia89.jpg

Re: Complex Texture Blending [Re: Pappenheimer] #400374
04/29/12 22:55
04/29/12 22:55
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I really love that game. I thoroughly enjoyed finding all the collectible bits, and loved the visuals. What a gorgeous game! I hope you're playing it with a good gamepad and not keyboard/mouse grin

I remember also wondering about how they did all the nice texture blending and decals, and I have a few ideas. PoP probably would've used a mixture of them (and perhaps some other tricks).

One is to split the world into individual meshes that only have a few different textures to be blended. Since normals are typically pre-calculated, vertices along seams can have the same normals and make it appear to be one giant mesh.

The other is the decal system -- I've never used GS decals (or any other engine's, for that matter). But it makes sense to render the decals immediately after rendering the world or whatever surface they're supposed to be projected on, with a depth offset to prevent z-fighting. A more-precise but perhaps less-practical method would be to have each decal's mesh precisely matching the faces it is being projected on and its origin matching that of the mesh it is being projected on so that they have the exact same transformation matrices (EDIT: this part may not be necessary with fixed-point coordinates like in GS, but I guess it depends on some lower level stuff I haven't learned about yet). Then as long as the depth-test allows a pixel to be rendered if its of EQUAL depth to what's already there, the decal gets rendered nicely over the surface beneath it. I can't recall exactly where, but I do recall seeing some indication that the PoP decals aren't quite that precise, so they probably do something like the former. GS appears to just use a bit of an offset, which I've only just learned now from the manual.

Are decals in GS that slow?

Last edited by JibbSmart; 04/29/12 23:21. Reason: I don't know some stuff

Formerly known as JulzMighty.
I made KarBOOM!
Re: Complex Texture Blending [Re: JibbSmart] #400377
04/29/12 23:26
04/29/12 23:26
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline OP
Senior Expert
Pappenheimer  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Originally Posted By: JibbSmart
Are decals in GS that slow?

I don't know, but most probably one would see some z-fighting.

Just another thought, because of something you mentioned:
Is it possible that one uses two identical models, both as almost huge as the level seems to be, and then render the textures with alpha channel of one of them always in front of the other? F.i. one model with the rocks and a second with the sand and scratches on it.

That wouldn't be a solution that is very easy to use, but it would be a beginning...

Re: Complex Texture Blending [Re: Pappenheimer] #400484
05/02/12 00:49
05/02/12 00:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Quote:
Is it possible that one uses two identical models, both as almost huge as the level seems to be, and then render the textures with alpha channel of one of them always in front of the other? F.i. one model with the rocks and a second with the sand and scratches on it.
That should work if you can guarantee that they render in the right order. If you're willing to get into shaders, you could render it in multiple passes, which would effectively be the same thing. In the end, it might as well be a multi-pass multi-texture shader if you're using identical models - the point of the decals is so that you don't have to render the entire model for each new layer.

If you're having z-fighting issues with decals, have you tried fiddling with d3d_near_decals? GS's decal system looks to be quite good from what the manual says about how it works, as long as you can overcome z-fighting.

Last edited by JustSid; 05/02/12 00:54. Reason: You are welcome :P

Formerly known as JulzMighty.
I made KarBOOM!
Re: Complex Texture Blending [Re: JibbSmart] #400507
05/02/12 14:37
05/02/12 14:37
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Complex blending is not necessarily slow. I don't see any problems to define for a mesh a base texture and 4 other textures encoded with a RGBA blendmap.

No one says that the used 4 textures are all the same for every other object. If you have e.g. two meshes for a big wooden surface you are not restricted to use as secondary texture on the one wood panel texture A, B, C & D and on the other one texture A, C, E & F.

You could either duplicate for each object the base material and use the mtlSkin1 ... mtlSkin4 as texture inputs or you use some sort of texture atlassing for the 4 textures (entSkin1 ... entSkin4), in which 4 subtextures are encoded each and you select via the shader skills which of the 4 textures each are used then, given that you implemented tiling for texture atlasses (which -is- possible).

Last edited by HeelX; 05/02/12 14:38.
Re: Complex Texture Blending [Re: HeelX] #400516
05/02/12 16:52
05/02/12 16:52
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
I think the point is that PoP blends a LOT of textures together on what appear to be single seamless meshes.

(Thanks Sid!)


Formerly known as JulzMighty.
I made KarBOOM!
Re: Complex Texture Blending [Re: JibbSmart] #400517
05/02/12 17:04
05/02/12 17:04
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Originally Posted By: JibbSmart
I think the point is that PoP blends a LOT of textures together on what appear to be single seamless meshes.
My problem is, that I don't know exactly why this is, or seems to be, true.

I think, that there are lots of overlay meshes. Take this image as example:



You can see at two locations, that this is not a unique mesh, which is merged together with the wooden ground:



You can see, that the green mesh is laid over the surrounding. Then, with alphablending, you achieve a nice blend with the environment.

The same goes for the big rock-walls, I think they "just" use regular multitexturing or so and throw in some decals, and thats it.

Re: Complex Texture Blending [Re: HeelX] #400523
05/02/12 19:21
05/02/12 19:21
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Quote:
Quote:
I think the point is that PoP blends a LOT of textures together on what appear to be single seamless meshes.
My problem is, that I don't know exactly why this is, or seems to be, true.
Well sure, there's more than one mesh in that screenshot. The point of that screenshot was specifically how the grass blends over the grating and wood surface beneath it. The transition from solid dirt-and-grass ground to a translucent grass overlay on the next mesh is seamless and quite nice. Pappenheimer's asking how this might be achieved in GS without z-fighting or alignment issues ("floating" above what's beneath it) while maintaining good performance (the whole game world is littered with such nice effects).


Formerly known as JulzMighty.
I made KarBOOM!
Re: Complex Texture Blending [Re: JibbSmart] #400524
05/02/12 19:43
05/02/12 19:43
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
I would try to

1) give the mesh a second uv-set with an alpha texture and
2) apply (multi) texture tiling, based on a blendmap
3) make sure that the other things beneath/behind it are rendered in the solid pass
4) and the mesh being rendered in the translucent pass

Page 1 of 2 1 2

Moderated by  checkbutton, mk_1 

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