ZioRed Posted March 7, 2010 Share Posted March 7, 2010 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: This is almost the same portion rendered in the client code: 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. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted March 7, 2010 Share Posted March 7, 2010 You need to enable terrain shadows. The terrain is a child of the scene entity. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted March 7, 2010 Author Share Posted March 7, 2010 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? Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted March 7, 2010 Share Posted March 7, 2010 With GameLib you can just do SetEntityShadowMode(scene.scene.terrain,1); when using scene.LoadMap() instead of LoadScene(). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted March 8, 2010 Author Share Posted March 8, 2010 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? Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Josh Posted March 8, 2010 Share Posted March 8, 2010 Neither image shows terrain casting shadows, so that is not an issue. I don't see any lighting being rendered at all in your second image. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Canardia Posted March 8, 2010 Share Posted March 8, 2010 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted March 9, 2010 Author Share Posted March 9, 2010 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: As you can see it is still darker as regards to the editor: Particularly regarding the "white" light on the mountains. What am I still doing wrong? Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted March 9, 2010 Share Posted March 9, 2010 Maybe you have Bloom and HDR enabled in Editor? Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted March 9, 2010 Author Share Posted March 9, 2010 Maybe you have Bloom and HDR enabled in Editor? Nope, I already disabled all effects in the editor. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted March 9, 2010 Share Posted March 9, 2010 Too much guessing, maybe you could post the terrain files and sbx file. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
ZioRed Posted March 9, 2010 Author Share Posted March 9, 2010 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. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Canardia Posted March 9, 2010 Share Posted March 9, 2010 I get the same result as in Editor: #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); } } Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
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.