Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Dico, AndrewAMD, TipmyPip), 16,874 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Proper application of shaders to sprites #276912
07/07/09 02:45
07/07/09 02:45
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline OP
Member
Jaeger  Offline OP
Member
J

Joined: May 2009
Posts: 258
Chicago
So, what's the correct way to use a shader on sprites? I kinda played around with it the other day, and it turned out bad. I've recently upgraded to some better shader code though, and models look great with it. For the sprites, I'm using some real world photos that I've taken of real plants. I've totally removed the background, all artifacts, and made it into a .tga image. As a regular sprite, with no shader, it looked fine. I just want to use shaders to get the most realism out of it.

I'm using a shader that supports normal mapping and spec mapping. For models, I can just order them in MED like:

Skin1 (diffuse)
Skin2 (normal mapping)
Skin3 (specular mapping)

...then save, and engine preview shows it in perfect form. It also works fine in a real level/world. I can do the same exact thing in code with the entskin parameters for a user-defined material.

So, where to go from here? Is it best to do this in WED, or in code? Maybe there is a way to create a model in MED, and just have it behave like a sprite? That would work, I'm sure. Maybe just make the sprite a blank image, then use the entskin parameters in my material code to assign the diffuse, normal, and specular mapping?

Re: Proper application of shaders to sprites [Re: Jaeger] #276973
07/07/09 09:55
07/07/09 09:55
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I dont THINK you can use shaders on sprites, but I could be wrong.

But if you build a flat square in MED, you could use that with all shaders.
You'll need a separate action in code to auto-rotate the entity the way sprites do all by themselves.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Proper application of shaders to sprites [Re: EvilSOB] #276984
07/07/09 10:09
07/07/09 10:09
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline OP
Member
Jaeger  Offline OP
Member
J

Joined: May 2009
Posts: 258
Chicago
Makes sense. I was kinda leaning towards that idea. I DID make a flat plane, and textured it with the materials. Did an engine preview, and it looked great. So I just I'll simply make it an ent that just faces the position of the player/camera, I guess.

So what would be a simple way to code it? I've got a knack for writing code that works, but which is hideously overcomplicated, lol.

Re: Proper application of shaders to sprites [Re: Jaeger] #276997
07/07/09 10:56
07/07/09 10:56
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Off the top of my head....
Code:
action shader_sprite()
{
	VECTOR tmpV;
	while(me)
	{
		vec_set(tmpV, camera.x); 
		vec_sub(tmpV, my.x);
		vec_to_angle(my.pan, tmpV);
	}
}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Proper application of shaders to sprites [Re: EvilSOB] #277010
07/07/09 11:38
07/07/09 11:38
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
You can use shaders with sprites. I've made extensive use of sprites with shaders for my entry in the shader contest, and I do it all the exact same way I do a shader for a normal model.

Haven't normal-mapped sprites, though.

You wouldn't want to deal with tangent space because that causes more overhead than necessary -- the normals would be in object space instead.

I hope that's helpful enough.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

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