Jump to content

Scene quality


ZioRed
 Share

Recommended Posts

When I load a SBX scene in the code, I don't succeed to achieve the same quality as the same scene is rendered in the editor expecially for the shadows.

 

This is a portion of the scene rendered in the editor:

editor.th.jpg

 

This is almost the same portion rendered in the client code:

clientn.th.jpg

 

The code I used to load the scene is the following:

 

TBuffer gbuffer = CreateBuffer(AODO_GAME_DEF_WIDTH, AODO_GAME_DEF_HEIGHT, BUFFER_COLOR | BUFFER_DEPTH | BUFFER_NORMAL);
TBuffer lightbuffer = CreateBuffer(AODO_GAME_DEF_WIDTH, AODO_GAME_DEF_HEIGHT,BUFFER_COLOR | BUFFER_DEPTH);

// Set graphic quality
SetTextureQuality(1);
TFilter(1);
AFilter(4);
fw.renderer.SetBloom(true);
fw.renderer.SetHDR(1);

DirectionalLight light;
light.Create();
light.SetPosition(Vec3(0, 1, 0), GLOBAL);
light.SetRotation(Vec3(44.9999924,34.9999924,2.14186755), GLOBAL);

Scene scene;
scene.Load("abstract::mappaprova2.sbx");
scene.SetType(2);

fw.main.GetWorld().SetAmbientLight(Vec3(1));
light.SetColor(Vec4(0.15));

 

EDIT: the SBX scene contains the environment Ambient entity, you can download the scene here.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

You need to enable terrain shadows.

The terrain is a child of the scene entity.

I suppose you're talking about calling SetShadowMode(1) to the terrain entity (or not? I already tried calling that method on the character which is of Mesh type but it don't appear with shadow on the body as it seems in the editor using the crawler sample GMF), so I tried to reproduce the GetFirstEntityByKey function of Gamelib into LEO (that I like more than procedural calls) but I fall into access violation errors.

 

The following are how I wrote them:

struct TKeyData
{
str key;
str value;
Entity result;
};

int _stdcall GetOneEntity(Entity e, TKeyData *data)
{
int i = 0;
if(NULL==data->result)
{	
	std::string s;
	s = e.GetKey(data->key, "nothing");
	if(s==data->value)
	{
		data->result=e;
		return 0;
	} else return 1;
} else return 0;
}

Entity GetFirstEntityByKey(Entity e, str key, str value)
{
TKeyData data;
data.key=key;
data.value=value;
data.result=NULL;
e.ForEachDo((BP)GetOneEntity, (BP)(TKeyData*)&data,ENTITY_MODEL);
return data.result;
}

 

then I tried to call:

Terrain terrain = (Terrain)GetFirstEntityByKey(scene, "class", "Terrain");

 

but the client stops giving the access violation on the last line of GetFirstEntityByKey ("return data.result")... I'm doing errors somewhere?

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

I have tried to to use Gamelib but with no success to achieve the editor graphic quality:

 

game.scene.LoadMap("abstract::mappaprova2.sbx");
AmbientLight(Vec3(1));
EntityShadowMode(game.scene.terrain,1);

 

Can someone try to achieve it and post me the code please (using the map linked in the topic and possibly using standard LEO) so I can learn what I'm doing wrong? ;)

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

AmbientLight(Vec3(1)) is for sure wrong, try rather AmbientLight(Vec3(0.1)), or whichever setting you have in Editor.

I use usually AmbientLight(Vec3(0)), since I want also completely black areas in my scenes. Then I just add some pointlights where I want some light bouncing from the directional light.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Well I changed something as suggested and now the code is the following:

 

TEntity light = CreateDirectionalLight();
RotateEntity(light, Vec3(45, 35, 0), 0);
LightRange(light, 500);
SetShadowmapSize(light, 1024);
SetShadowDistance(light, 6, 0);
SetShadowDistance(light, 20, 1);
SetShadowDistance(light, 100, 2);
AmbientLight(Vec3(0.6));

 

But the result is the following:

immagine2p.th.png

 

As you can see it is still darker as regards to the editor:

editor.th.jpg

 

Particularly regarding the "white" light on the mountains. What am I still doing wrong? :mellow:

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

The downloadable map RAR in the topic contains the .SBX, .DDS and .RAW, it should be all: download here.

 

Thank you in advance and sorry, I'm trying to code my first game at all :)

 

PS: I'm almost thinking to ask for hire (pay per hour) someone from the community to help in this first times until I good understand how to play with the engine by myself.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

I get the same result as in Editor:

post-2-12681549897095_thumb.jpg

 

#include "gamelib.h"

int main()
{
Game game(CREATENOW);
RegisterAbstractPath("c:/program files/leadwerks engine sdk");
game.Initialize(800,600);
game.scene.LoadMap("abstract::mappaprova2.sbx");
TPlayer player;
player.Create();
game.scene.player["joe"]=player;
game.scene.SetCurrentPlayer("joe");
while(!KeyHit())
{
	game.scene.Update();
	game.scene.Render();
	game.scene.Flip();
	game.MouseLook(game.scene.cam);
}
}

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...