4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Shade-C all in one FX
[Re: sivan]
#440120
04/18/14 11:51
04/18/14 11:51
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
Yes, like Sivan mentioned the fx files are limited like WAD and MDL models files to 15 characters....Yes when I enable sc_setup and create one light the fps drops by 1/3 Hmm strange, i got stable 60fps eg. 144 dynamic lights, like code below.
#include <default.c>
#define PRAGMA_PATH "shadec"
#include "shade-c.h"
#include "common.h"
ENTITY* skycube =
{
type = "plain_abraham+6.tga";
flags2 = SKY | CUBE | SHOW;
red = 130;
green = 130;
blue = 130;
}
VECTOR vSpeed, vAngularSpeed, vForce, vMove;
ENTITY* spotlight[144];
void main()
{
fps_max = 60;
shadow_stencil = -1;
video_set(800, 600, 0, 2);
level_load("05.wmb");
wait(3);
vec_set(sun_color, vector(0,0,0));
vec_set(ambient_color, vector(0,0,0));
vec_set(camera.x,vector(840,-870,700));
vec_set(camera.pan,vector(135,-40,0));
camera.arc = 90;
sc_sky(skycube);
sc_screen_default = sc_screen_create(camera);
sc_setup(sc_screen_default);
int i,j,k=0;
var dist_x = -646, dist_y = 520;
random_seed(0);
for (i=0;i<12;i++){
for (j=0;j<12;j++){
spotlight[k] = sc_light_create(vector(dist_x,dist_y,200), 500, vector(random(255),random(255),random(255)), SC_LIGHT_SPOT | SC_LIGHT_SPECULAR, vector(0,-90,0), 40);
k++;
dist_x += 114;
}
dist_x = -646;
dist_y -= 114;
}
for (k=0;k<143;k++)
sc_light_update(spotlight[k]);
def_debug();
draw_textmode("Arial",3,16,100);
var speed = 20;
while(1)
{
draw_text("click and hold [RMB] and use [QWEASD] keys to move the camera",2,115,COLOR_GREEN);
if(mouse_right) // Move the camera if the right mouse button was pressed
{
vForce.x = -speed *(key_force.x + mouse_force.x); // pan angle
vForce.y = speed *(key_force.y + mouse_force.y); // tilt angle
vForce.z = 0; // roll angle
vec_accelerate(vMove,vAngularSpeed,vForce,0.8);
vec_add(camera.pan,vMove);
vForce.x = speed * (key_w - key_s); // forward
vForce.y = speed * (key_a - key_d); // sideward
vForce.z = speed * (key_q - key_e); // upward
vec_accelerate(vMove,vSpeed,vForce,0.5);
vec_rotate(vMove,camera.pan);
vec_add(camera.x,vMove);
}
wait(1);
}
}
|
|
|
Re: Shade-C all in one FX
[Re: rojart]
#440125
04/18/14 14:46
04/18/14 14:46
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Okay, thats good to know If I reduce my screen size to 800x600 then my fps stays around 60. Otherwise I get an fps of 31 or so at 1280x720. Since the upgrade to my project, I'll have to do some level optimizing - my level dimensions are around 6000x4000 - that being my biggest level conisting of several rooms and models adding to 306 entities (using LOD stages) -> My Nexus is 339573 and that has to be bad.. since I read that 500MB is commercial size.. mem is 391, geo and shad 0 -> ents 274 and 1578 Free. This level is only 25% done (If that).. Face Palm..
Last edited by DLively; 04/18/14 14:46.
|
|
|
Re: Shade-C all in one FX
[Re: DLively]
#440147
04/19/14 01:57
04/19/14 01:57
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
I wanted to note that my model works when: entskin1 = diffuse entskin2 = specular (G,B,A are black) entskin3 = NormalMap (Alpah is Black) --------------------- Am I doing something wrong? Cause I tried to follow the instructions that were given to Random in a seperate post and although he was successful in his results after following the instructions, I was not. I would like to also ask how to add Shadows now
|
|
|
Re: Shade-C all in one FX
[Re: DLively]
#440156
04/19/14 09:37
04/19/14 09:37
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
Okay, thats good to know ...If I reduce my screen size to 800x600 then my fps stays around 60. Otherwise I get an fps of 31 or so at 1280x720... Ok, checked in fullscreen resolution by full HD (1920x1080) for you and i get ~31fps > ~60fps depending of the distance to the ground. You can test my exe in relation of performance also. My Computer Specs: OS: Windows 8.1 Pro 64-bit CPU: i7-4770 @ 3.40GHz GPU: GeForce GTX 760 @ 2048MB RAM: 16GB PRG: A8 Pro 8.45.4 Since the upgrade to my project, I'll have to do some level optimizing - my level dimensions are around 6000x4000 - that being my biggest level conisting of several rooms and models adding to 306 entities (using LOD stages)... You use the Automated Managed Level of Detail from MED for your models (MED > Object > Manage Level of Detail), right? ...How do I use particles with shadec? sc_screen_default.settings.forward.enabled = 1; //enable if you need particles or custom materials which can't be rendered in the deferred pipeline Was this? I wanted to note that my model works when: entskin1 = diffuse entskin2 = specular (G,B,A are black) entskin3 = NormalMap (Alpah is Black) --------------------- Am I doing something wrong? It seems to me, that you've another chronology of skin numbers. Your Specular have skin2.x and Normalmap skin3.xyz If you need the same like me, then change to:
//assign skins
#define SKIN_ALBEDO (skin1.xyz) //diffusemap
#define SKIN_ALPHA (skin1.w) //alpha
#define SKIN_NORMAL (skin2.xyz) //normalmap
#define SKIN_GLOSS (skin2.w) //glossmap
...I would like to also ask how to add Shadows now It's very simple, add this flag SC_LIGHT_SHADOW to the light function:
spotlight[k] = sc_light_create(vector(dist_x,dist_y,200), 500, vector(random(255),random(255),random(255)), SC_LIGHT_SPOT | SC_LIGHT_SPECULAR | SC_LIGHT_SHADOW, vector(0,-90,0), 40);
|
|
|
Re: Shade-C all in one FX
[Re: rojart]
#440165
04/19/14 13:30
04/19/14 13:30
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Mine looks like this? I had added : ENTITY* light_child = sc_light_create(vector(0,0,0), sc_lightrange, vector(255,140,80), SC_LIGHT_SHADOW); and get no shadows -> about to try your suggested methods -> You rock Rojart ... Okay shaodws are working however to make my work a little less guessy - Could I ask what these peramteres are? spotlight[k] = sc_light_create(vector(dist_x,dist_y,200), LIGHTRANGE*, COLOR RGB*, SC_LIGHT_SPOT | SC_LIGHT_SPECULAR | SC_LIGHT_SHADOW, vector(0,-90,0), 40);
|
|
|
Re: Shade-C all in one FX
[Re: DLively]
#440175
04/19/14 17:48
04/19/14 17:48
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
1280X720 zoomed out I get 10Fps with your example Rojart The computer I am using only has 4GB of Ram and 512MB Card My other machine has 8GB or Ram and 1024MB GPU. Is there a way to acchieve these graphics without the huge loss of fps? I've played games on this computer that would require so much more reources than I use - and I my fps doesn't drop - It obviously must be me.
Last edited by DLively; 04/19/14 17:50.
|
|
|
Re: Shade-C all in one FX
[Re: DLively]
#440176
04/19/14 18:28
04/19/14 18:28
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
OP
Serious User
|
OP
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
Here's a note:
#define SKIN_ALBEDO (skin1.xyz) //diffusemap
#define SKIN_ALPHA (skin1.w) //alpha
#define SKIN_NORMAL (skin3.xyz) //normalmap
#define SKIN_GLOSS (skin3.w) //glossmap
which is skin 1 and 3 //------------------------------------------------------------------------------ //----- USER INPUT ------------------------------------------------------------- //------------------------------------------------------------------------------
//assign skins #define SKIN_ALBEDO (skin1.xyz) //diffusemap #define SKIN_ALPHA (skin1.w) //alpha #define SKIN_NORMAL (skin3.xyz) //normalmap #define SKIN_GLOSS (skin3.w) //glossmap //#define SKIN_EMISSIVEMASK (skin3.y) //emissive mask //#define SKIN_COLOR (skin3.w) //(team)color mask //#define SKIN_EMVMAPMASK (skin3.x) //environment mapping mask //#define SKIN_VELVETYMASK (skin3.z) //velvety lighting mask //...
//#define MTL_SKIN1 //skin1 is a mtlSkin and not an entSkin? //#define MTL_SKIN2 //skin2 is a mtlSkin and not an entSkin? //#define MTL_SKIN3 //skin3 is a mtlSkin and not an entSkin? //#define MTL_SKIN4 //skin4 is a mtlSkin and not an entSkin?
#define NORMALMAPPING //do normalmapping?
#define GLOSSMAP //entity has glossmap? #define GLOSSSTRENGTH 0 //glossmap channel will be set to this value if GLOSSMAP is not defined
//#define EMISSIVEMASK //use emissive mask? (formula: emissive_color = SKIN_EMISSIVEMASK * SKIN_ALBEDO) //#define EMISSIVE_A7 // (optional EMISSIVEMASK addon) use emissive_red/green/blue for as emissive color? (formula: emissive_color = SKIN_EMISSIVEMASK * vecEmissive) //#define EMISSIVE_SHADEC // (optional EMISSIVEMASK addon) OR use SC_OBJECT_EMISSIVE as emissive color? (formula: emissive_color = SKIN_EMISSIVEMASK * SC_OBJECT_EMISSIVE)
//#define OBJECTCOLOR_A7 // use diffuse_red/green/blue as (team)color using the colormask? //#define OBJECTCOLOR_SHADEC // OR use SC_OBJECT_COLOR as (team)color using the colormask?
//#define ALPHACLIP //do alphatesting/alphacutout?
//#define USE_VEC_DIFFUSE //use diffuse_red/green/blue? (note: don't use with OBJECTCOLOR_A7 at the same time)
//#define ZPREPASS //do an early zbuffer prepass? Only makes sense for heavy ALU
//------------------------------------------------------------------------------ // ! END OF USER INPUT ! //------------------------------------------------------------------------------
#include <scHeaderObject> // <- // insert custom code here // -> #include <scObject>
I changed that and it works now Starting to figure shadows out too Thank you for your patience!!
|
|
|
|