Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (wandaluciaia, AndrewAMD, 1 invisible), 765 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Scaling Models #440223
04/20/14 19:09
04/20/14 19:09
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I read that scaling models reduces frame rate - Does this only apply to > 1.000 or does it also apply if Im scaling a model smaller?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Scaling Models [Re: DLively] #440225
04/20/14 19:48
04/20/14 19:48
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
If you change the scale of a model (many or few with a reasonable number of vertices) every frame this does indeed have a notable impact on the framerate (the value is not really important, only bigger models result in more pixels to be drawn), if you only do it once or a few times or only for a few models it's perfectly fine.
Generally speaking just go ahead and do it and only optimize if necessary (one optimization - what I normally do - is to scale the model in the vertex shader via vecSkill41).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Scaling Models [Re: Superku] #440227
04/20/14 23:39
04/20/14 23:39
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Thanks for your feedback Superku,

So I now understand that regardless of scaling up or down it has an effect, and will alter the fps. Now is this limited to objects within the Clipping range? So lets say I have 4 quadrants for example, one in each corner of a Huge Level, so they are not in the same clipped area - Would this be acceptable? (remember this is just for my knowledge) tongue

Related to the shader option -> Is that something complex that you figured out, or is it preset somehow that I could figure it out? tongue Keeping in mind that I'm still in the grey with shaders xD

Does anyone know if this comes with Shade-c?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Scaling Models [Re: DLively] #440229
04/21/14 00:26
04/21/14 00:26
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I think I don't understand your first question, sorry. wink
However, I am not sure if the scaling is (framerate) dependent on rendering or not, I'd guess it's not the case (one would have to test that, and maybe with or without PASSABLE flag).

I am not familiar with writing shaders like the default engine shaders (because I don't know or really like those macros) or Shade-C at all but in my own vertex shader I'd proceed as follows:
For pretty much all of my shaders I use the following base shader (roughly taken from the shader tutorial):
Code:
float4x4 matWorldViewProj;
float4x4 matWorld;
float4 vecAmbient;
float4 vecSunDir;

texture entSkin1;

sampler ColorMapSampler = sampler_state 
{ 
   Texture = <entSkin1>; 
   AddressU  = Clamp; 
   AddressV  = Clamp; 
}; 
    
void DiffuseVS( 
   in float4 InPos: POSITION, 
   in float3 InNormal: NORMAL, 
   in float2 InTex: TEXCOORD0, 
   out float4 OutPos: POSITION, 
   out float2 OutTex: TEXCOORD0, 
   out float3 OutNormal: TEXCOORD1) 
{ 
   OutPos = mul(InPos, matWorldViewProj); 
   OutNormal = normalize(mul(InNormal, matWorld));
   OutTex = InTex; 
} 
    
float4 DiffusePS( 
   in float2 InTex: TEXCOORD0, 
   in float3 InNormal: TEXCOORD1): COLOR 
{ 
   float4 Color = tex2D(ColorMapSampler, InTex); 
   float Diffuse = 0.5+0.5*saturate(dot(-vecSunDir, normalize(InNormal))); 
   float4 final = Color*Diffuse;
   
   return final;
} 
 
technique DiffuseTechnique 
{ 
   pass P0 
   { 
      VertexShader = compile vs_3_0 DiffuseVS(); 
      PixelShader  = compile ps_3_0 DiffusePS(); 
   } 
}


Then I modify it as needed. In this case I'd add vecSkill41 as a float4, then multiply InPos.xyz in the vertex shader with vecSkill41.x or vecSkill41.xyz (when I want to have axis independent scaling) (and of course initialize those skills in script with floatv()).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Scaling Models [Re: Superku] #440230
04/21/14 01:16
04/21/14 01:16
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I re-read the manual and understand it more correctly now -> I think you already answered the question though.

Quote:

The bigger a model or sprite is scaled, and the closer it is to the camera, the slower it is rendered. The rendering time depends on the number of pixels that the object covers on the monitor.


So if I had 5 models in 5 different sectors of the level, they wouldn't be on camera anyway. this would apply to such things as Grass, if they were randomly scaled.


Thanks for the base Shader. I don't know too much about them, as said, but I do appreciate this kind resource! I will have to study more to understand the adding of more commands to a shader, but this is a very huge head start when I use custom shaders!

You're custom shaders (in your recent videos) are very well done btw laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com

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