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
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 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
Page 2 of 4 1 2 3 4
Re: Specular Shader [Re: DexLoomer] #477161
05/25/19 18:19
05/25/19 18:19
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
Here goes my testbench. I hope it helps.

Re: Specular Shader [Re: txesmi] #477162
05/25/19 20:03
05/25/19 20:03
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
That's awesome. It runs perfectly. I will have to see how much it slows down my game, since I have a lot of plants that would use it, but I will definitely add it, maybe make it an option for people with faster computers if it makes a big difference in framerate.

Re: Specular Shader [Re: Dooley] #477163
05/26/19 12:27
05/26/19 12:27
Joined: Jan 2006
Posts: 168
Germany, Hannover
DexLoomer Offline
Member
DexLoomer  Offline
Member

Joined: Jan 2006
Posts: 168
Germany, Hannover
Hello, first of all many thanks for the support!

The 'specTrans' Shader also looks great, as you can see on the picture:



But what is the ´specBumpTrans´ shader for? This does not seem to work (only color_Map + Tranparenz_Map).
Or am I doing something wrong? I commented it out in the main.c and assigned it to the cube in the WAD:



In addition, I came across yet another problem. The object with the 'specTrans' Sahder takes on no shadow.





The code is only extended by the shadow function:

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
//#include <mtlFX.c>
#include <shadows.c>
///////////////////////////////
var shadow_flag = 1; 	// Einfacher Schatten



MATERIAL *mtlSpecTrans = {
   effect = "SpecTrans.fx";
}

MATERIAL *mtlSpecBumpTrans = {
   effect = "specBump.fx";
   technique = "spec_trans";
}


// Startet Schatten bei dem der Schatten einer Entity
// auch auf sich selber geworfen werden kann.
function setShadow() 
{
	if (shadow_flag == 1) // Schatten: Stancil mit Eigenschatten	
	{	
		//		stencil_blur(0);
		pssm_run(0);
		shadow_stencil = 1;
		
		for(you = ent_next(NULL); you; you = ent_next(you)) 
		{
			reset(you, CAST);
			set(you, SHADOW);
			you.shadow = NULL;
		}
	}
	
	if (shadow_flag == 2)
	{
		// Dieser Schatten kann nur aktiviert werden, wenn die
		// Grafikkarte Shadermodel 3 oder höher unterstützt.
		if (d3d_shaderversion >= 3)
		{			
			// Deaktivieren des PSSM um dessen Parameter ändern zu können.
			pssm_run(0);
			//			stencil_blur(0);
			for(you = ent_next(NULL); you; you = ent_next(you)) {
				reset(you, CAST);
				set(you, SHADOW);
				you.shadow = NULL;
			}
			shadow_stencil = 8;	
			// Clip-Werte so nah wie möglich zusammenlegen.
			camera.clip_near = 30;
			camera.clip_far = 3000;
			// Fehlerquotienten setzen, dieser Wert wird durch ausprobieren
			// optimiert.
			pssm_fbias = 0.0005;
			pssm_run(3);		
		}
		else
		{
			printf("Ihre Grafikkarte unterstützt Shader Model 3 nicht!");
		}		
	}	
}







void main () {
	video_mode = 10;
	wait(3);
	sun_light = 0;
	level_load("spec.wmb");
	
	setShadow();
	
	def_move();	
	
	while(!key_esc) {
		
		wait(1);
	}
	
	sys_exit(NULL);
}



A8-Com-v 8.47.1
Re: Specular Shader [Re: DexLoomer] #477165
05/26/19 15:33
05/26/19 15:33
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
Originally Posted By: DexLoomer
But what is the ´specBumpTrans´ shader for? This does not seem to work (only color_Map + Tranparenz_Map).

It's the engine shader modification I explained before. I left it there for Dooley. He is working with A7. If the engines specBump works for him, it should work same.

Originally Posted By: DexLoomer
In addition, I came across yet another problem. The object with the 'specTrans' Sahder takes on no shadow.

Entities drawn by the translucent pass do not cast nor receive stencil shadows. Stencil shadows are geometry based, translucent entities are discarded.

I added a technique for solid rendering and fog, the only thing left, I guess.
download

Re: Specular Shader [Re: txesmi] #477166
05/26/19 16:27
05/26/19 16:27
Joined: Jan 2006
Posts: 168
Germany, Hannover
DexLoomer Offline
Member
DexLoomer  Offline
Member

Joined: Jan 2006
Posts: 168
Germany, Hannover
Hey, txesmi

So far, everything looks great! And you were right about the problem with the shadows. These are now working.

I have one more question: If I do not use fog, or this with ´camera-> fog_start = 0;´ disable, the boxes continue to have a foggy surface.



Is it possible to turn this on or off as well?

Last edited by DexLoomer; 05/26/19 19:37.

A8-Com-v 8.47.1
Re: Specular Shader [Re: DexLoomer] #477168
05/26/19 19:34
05/26/19 19:34
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
Oh, it is true, I am sorry, forgot to multiply the fog term by 'vecFogColor.w' (68th code line of 'Spec.fx').

Code:
float fFog = saturate((camDist - vecFog.x) * vecFog.z) * vecFogColor.w;



Anyway, the fog is activated/deactivated by 'fog_color' variable in liteC.

Salud!

Re: Specular Shader [Re: txesmi] #477169
05/26/19 19:55
05/26/19 19:55
Joined: Jan 2006
Posts: 168
Germany, Hannover
DexLoomer Offline
Member
DexLoomer  Offline
Member

Joined: Jan 2006
Posts: 168
Germany, Hannover



Jap .. seems to go. Looks good! Thanks again. I will test it in the next few days and try to build in my project laugh


Last edited by DexLoomer; 05/26/19 19:56.

A8-Com-v 8.47.1
Re: Specular Shader [Re: DexLoomer] #477170
05/26/19 20:08
05/26/19 20:08
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
@DexLoomer I am curious why you are using this shader instead of the standard mtl_specBump shader. On solid objects like boxes, it does not really serve its purpose.

So, the mtl_specBump does include a specular map, but it is in the alpha channel of the color map.

For me, since I was using the alpha channel to create transparent textures for plants and stuff, I could not use it for specular shading. This shader is specifically made to allow a transparent entity to also have a specular map.

Re: Specular Shader [Re: Dooley] #477171
05/26/19 22:15
05/26/19 22:15
Joined: Jan 2006
Posts: 168
Germany, Hannover
DexLoomer Offline
Member
DexLoomer  Offline
Member

Joined: Jan 2006
Posts: 168
Germany, Hannover
Hi Dooley, thanks for the hint, but I had some trouble with the mtl_specBump.

Also, I find the shader of 'txesmi' better in comparison.

Look ..on the left side ´mtl_specBump´ (with spec_map in the alpha channel of the color chart) and on the right side ´mtlSpecSolid´:



A8-Com-v 8.47.1
Re: Specular Shader [Re: DexLoomer] #477172
05/26/19 23:25
05/26/19 23:25
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
@DexLoomer
That is strange. mtl_specBump works fine for me with solid objects. You may want to try that a bit more, since txesmi mentioned this would be a much slower way to render objects.

@txesmi The first version worked great, but for the second (specBump2) I can't run it with the "technique = "SpecTrans";" or "technique = "SpecSolid";" lines. It works fine if I comment out these lines, but my version of gamestudio does not recognize the "technique" command. At least not where you have placed them in the MATERIAL* definition.

When I comment out the lines, it does seem to work fine though, but I'm not sure if it's working as intended...

Page 2 of 4 1 2 3 4

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