Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (ozgur, EternallyCurious, howardR, 1 invisible), 623 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shademode=flat does not work on Intel graphicchips #435621
01/09/14 17:44
01/09/14 17:44
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline OP
Expert
Puppeteer  Offline OP
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
I realized that flat shading does not seem to work on Intel graphicchips like the Intel HD 4000.

How it looks on regular GPUs:
Click me

How it looks on Intel Chips:
Click me

Is it supported? Am I doing something wrong?

Here a little bit of code to try out for yourself:
Code:
#include <acknex.h>

MATERIAL* mat1={
	effect="
	const float4x4 matWorldViewProj; // World*view*projection matrix. 
	texture entSkin1;
	
	sampler ColorMapSampler = sampler_state 
	{ 
	   Texture = <entSkin1>; 
	}; 
	
struct VS_OUTPUT
{
	float4 position : POSITION0;
	float4 color : COLOR0;
};

VS_OUTPUT DiffuseVS( 
   in float4 InPos: POSITION, 
   in float2 InTex: TEXCOORD0)
{ 
	VS_OUTPUT output;
	output.position=InPos;
   output.position = mul(output.position, matWorldViewProj); 
   output.color=tex2Dlod(ColorMapSampler,float4(InTex.xy,0.0f,0.0f));
   return output;
} 
 
float4 DiffusePS(in float4 col : COLOR0) : COLOR0
{
	return col;
}

// Technique: 
technique DiffuseTechnique 
{ 
   pass P0 
   {
   	shademode=flat;
      VertexShader = compile vs_3_0 DiffuseVS(); 
      PixelShader = compile ps_3_0 DiffusePS();
   } 
} 	
	";
	
	
	
}

void main()
{
	level_load(NULL);
	camera.x=150;
	camera.pan=180;
        //Choose a model you like here =)
	you=ent_create("player.mdl",NULLVECTOR,NULL);
	you.material=mat1;
}



Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: Shademode=flat does not work on Intel graphicchips [Re: Puppeteer] #435629
01/09/14 21:28
01/09/14 21:28
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I don't think you're doing anything wrong.

afaik there are a couple of things which (some ?) intel graphics cards do not support.


POTATO-MAN saves the day! - Random
Re: Shademode=flat does not work on Intel graphicchips [Re: Kartoffel] #435631
01/09/14 22:30
01/09/14 22:30
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I don't know how intel can make such a bad cards in general. but they need low power. I can test it for you tomorrow.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Shademode=flat does not work on Intel graphicchips [Re: sivan] #435644
01/10/14 08:42
01/10/14 08:42
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
My brother's got an Intel in his laptop aswell.
I'll let him try it and post the result.


POTATO-MAN saves the day! - Random
Re: Shademode=flat does not work on Intel graphicchips [Re: Kartoffel] #435656
01/10/14 10:58
01/10/14 10:58
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
yes it looks like that exactly. tested with ATI radeon hd 7670m and intel hd4000.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Shademode=flat does not work on Intel graphicchips [Re: sivan] #435692
01/10/14 20:47
01/10/14 20:47
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline OP
Expert
Puppeteer  Offline OP
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
I think it can be done.
If you comment this line out:
PixelShader = compile ps_3_0 DiffusePS();

You will see that without a PixelShader it is proper flat shading.
But I need a pixelshader so that is not an option for me.


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: Shademode=flat does not work on Intel graphicchips [Re: Puppeteer] #436098
01/19/14 19:27
01/19/14 19:27
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
I do believe that it is a driver problem and especially not a gamestudio bug, because as far as I know it just uses the directx api to load and compile .fx files and there isn´t much to mess up.

The best solution which you should use anyways is to not use a flat shademode, but use the default setting instead and then split your meshes polygons. As a result it will look the same on all hardware and better than it currently does, because it then uses real face normals instead of the currently used per vertex normals which don´t exactly fit the shaded faces.

Re: Shademode=flat does not work on Intel graphicchips [Re: Slin] #436196
01/21/14 14:11
01/21/14 14:11
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline OP
Expert
Puppeteer  Offline OP
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
I fixed all those issues you described with flat shading by rebuilding edge splitted meshes to meshes optimized for flat shading with correct normals etc. using some digital awesome.

Because the problem is if I keep the edge splitted models that work in all shade modes my vertex count is way to high.
Using the method above I loose about 66% of all vertexes, which is quite a lot.


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: Shademode=flat does not work on Intel graphicchips [Re: Puppeteer] #436202
01/21/14 14:36
01/21/14 14:36
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
How high is your vertex count for a complete scene? Because usually the vertex count is not a bottleneck...

Re: Shademode=flat does not work on Intel graphicchips [Re: Slin] #436273
01/22/14 19:40
01/22/14 19:40
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline OP
Expert
Puppeteer  Offline OP
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
The scence I am currently working with has 1235000 vertices.


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com

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