darrenc182 Posted April 4, 2010 Share Posted April 4, 2010 I am trying to render an outdoor scene with terrain, a skybox and my simple HUD. I can render the HUD in the transparency world with the Terrain, but I cannot render the skybox, terrain and HUD together. I can also render the skybox and terrain just fine by themselves also. I am putting my HUD in the transparency world like this: fw.GetTransparency().SetWorld(); CreateAmmoHUD(); CreateHealthHUD(); fw.GetMain().SetWorld(); I am rendering the skybox like this: fw.GetRenderer().SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat")); When that is commented out terrain and HUD render fine. When it is uncommented then I get a black screen with the HUD display but no skybox and no terrain, however everything renders fine for the first frame and after that I get a black screen with the HUD only. Does anyone have an idea on how I can fix this, or is this potentially a bug? All help will be greatly appreciated. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Marleys Ghost Posted April 5, 2010 Share Posted April 5, 2010 what are you using for your HUD ? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
darrenc182 Posted April 5, 2010 Author Share Posted April 5, 2010 what are you using for your HUD ? I'm using plane meshes and textures with alpha channels if I remember correctly and I'm parenting all of the plane meshes to the camera. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Sanctus Posted April 26, 2010 Share Posted April 26, 2010 Don't know if you solved this or not but if you use SetBlend with alpha blend you should set the blend back to none before drawing the scene. That worked for me. Quote I create the game you play. I create the rulles you will obey. Link to comment Share on other sites More sharing options...
VeTaL Posted October 27, 2010 Share Posted October 27, 2010 This is old thread, but i dont want to create new one with the same problem. Looking like this dont works for particles SetBlend(BLEND_ALPHA); TEmitter emitter = CreateEmitter(20,800,Vec3(0,0.2,0),1, _parentEnt); PaintEntity(emitter, g_gunSmoke); SetEmitterRadius(emitter,0.005,0.1); SetBlend(0); Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted October 28, 2010 Share Posted October 28, 2010 Why should it? SetBlend is for the drawing commands. Set the world to the transparency world using SetWorld, and then back again to the main world after creating the emitter. The Wiki is your friend. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted October 28, 2010 Share Posted October 28, 2010 http://www.leadwerks.com/wiki/index.php?title=Worlds#SetWorld There is not too many info... I saw tutorial on transparency, there is creation of new worlds, changing them and so on... Isnt it done in TFramework ? In another words, is there defined-in-TFramework transparent world? PS: Here it is http://www.leadwerks.com/wiki/index.php?title=Framework#GetFrameworkLayer Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted October 28, 2010 Share Posted October 28, 2010 Anyway, this also don't works SetWorld(GetLayerWorld(GetFrameworkLayer(1))); TEmitter emitter = CreateEmitter(20,800,Vec3(0,0.2,0),1, _parentEnt); PaintEntity(emitter, g_gunSmoke); SetEmitterRadius(emitter,0.005,0.1); SetWorld(GetLayerWorld(GetFrameworkLayer(0))); Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted October 28, 2010 Share Posted October 28, 2010 So, how can i make good emitter using C++ ? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
ZioRed Posted October 29, 2010 Share Posted October 29, 2010 Are you sure that your emitter doesn't work? At first glance you are using a one-shot emitter, so may be it's "quick" and you don't see it, try to using a looping ones, the following code works for me: TFramework fw = CreateFramework(); TCamera camera = GetLayerCamera( GetFrameworkLayer(0) ); TModel crawler = LoadModel("abstract::crawler.gmf"); TModel crawler2 = LoadModel("abstract::crawler.gmf"); MoveEntity(crawler2, Vec3(-2,0,0)); TMaterial mat = LoadMaterial("abstract::dust.mat"); TEmitter emitter = CreateEmitter(50,3000,Vec3(0,4,0)); PaintEntity(emitter, mat); SetEmitterRadius(emitter,0.005,0.1); PositionEntity(emitter, EntityPosition(crawler)); EntityParent(emitter, crawler); PositionEntity(camera, EntityPosition(crawler)); MoveEntity(camera, Vec3(0,0,-3)); flt mx = 0, my = 0; HideMouse(); TVec3 camrotation = Vec3(0); while( !KeyHit() && !AppTerminate() ) { mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; camrotation.Y=camrotation.Y-mx/10.0; RotateEntity(camera,camrotation); if (KeyHit(KEY_C)) { mx = 0; my = 0; camrotation = Vec3(); PointEntity(camera, crawler); } if (KeyHit(KEY_X)) { TEmitter newEmitter = CreateEmitter(50,3000,Vec3(0,4,0)); PaintEntity(newEmitter, mat); EntityColor(newEmitter, Vec4(0,0,1,1)); SetEmitterRadius(newEmitter,0.005,0.1); PositionEntity(newEmitter, EntityPosition(crawler)); MoveEntity(newEmitter, Vec3(0, 0, 2)); EntityParent(newEmitter, crawler); } TVec3 pos = EntityPosition(crawler); if (KeyHit(KEY_D)) pos.X += 0.5f; if (KeyHit(KEY_A)) pos.X -= 0.5f; if (KeyHit(KEY_W)) pos.Y += 0.5f; if (KeyHit(KEY_S)) pos.Y -= 0.5f; if (KeyHit(KEY_Q)) pos.Z += 0.5f; if (KeyHit(KEY_E)) pos.Z -= 0.5f; PositionEntity(crawler, pos); UpdateFramework(); RenderFramework(); Flip(); } Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
VeTaL Posted October 29, 2010 Share Posted October 29, 2010 Thanks, ZioRed, but i was talking about making particles transparent and gave code of my trying to set transparent world. In tutorial, there is //Render the world SetBuffer(gbuffer); RenderWorld(); //Render lighting SetBuffer(BackBuffer()); RenderLights(gbuffer); But as far as i know, framework already manages worlds and buffers. So, thats what i'm stucked in: how can i render transparent entity (probably particles, not 2d text) in framework? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 29, 2010 Share Posted October 29, 2010 This is taken from my engine's fire object class and the smoke emitter is using a transparent material for the particles. This definitely works for me. I'm using framewerk rather than framework (and a modified version to allow direct buffer access) but this should work just as well with framework. Hope this helps: void fire::createEmitters(void) { float intensity; float lifetime; // Set transparent world m_pFramewerk->GetTransparency().SetWorld(); // Create the smoke emitter intensity = 25+(m_fSmokeWidth*50); lifetime = (m_fSmokeHeight/m_fSmokeSpeed)*1000; TEmitter smoke = CreateEmitter(50,lifetime,Vec3(0,m_fSmokeSpeed, 0)); EntityColor(smoke,Vec4(1,1,1,0.25)); PaintEntity(smoke,LoadMaterial("abstract::softdust.mat")); SetEmitterRadius(smoke,0.3,0.3); // 0.5,0.5 SetEmitterWaver(smoke,0.4); SetEmitterRotationSpeed(smoke,0.5); SetEmitterArea(smoke,Vec3(m_fSmokeWidth)); // 0.5 PositionEntity(smoke,Vec3(getObjectPosition().X,getObjectPosition().Y + (m_fFireHeight*0.5),getObjectPosition().Z),1); // Create the fire emitter intensity = 100+(m_fFireWidth*100); lifetime = (m_fFireHeight/m_fFireSpeed)*1000; TEmitter fire = CreateEmitter(intensity,lifetime,Vec3(0,m_fFireSpeed,0)); EntityColor(fire,Vec4(1,0.5,0,0.3)); PaintEntity(fire,LoadMaterial("abstract::fire.mat")); SetEmitterRadius(fire,0.25,0.15); SetEmitterWaver(fire,0.25); SetEmitterRotationSpeed(fire,0.5); SetEmitterArea(fire,Vec3(m_fFireWidth)); // 0.4 PositionEntity(fire,getObjectPosition(),1); // Create the heat haze emitter TEmitter heat = CreateEmitter(20,1000,Vec3(0,m_fFireSpeed,0)); TMaterial material=LoadMaterial("abstract::heathaze.mat"); m_pFramewerk->GetRenderer().SetHeatHazeTexture(material); PaintEntity(heat,material); SetEmitterRadius(heat,0.50,0.50); SetEmitterWaver(heat,0.5); SetEmitterRotationSpeed(heat,0.1); SetEmitterArea(heat,Vec3(0.25)); PositionEntity(heat,getObjectPosition(),1); // Set main world m_pFramewerk->GetMain().SetWorld(); } You also need to ensure you have the line: blend=alpha in your material file or you won't get the transparency. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted October 29, 2010 Share Posted October 29, 2010 Thats the main question of this thread: how to change m_pFramewerk->GetTransparency().SetWorld(); to framewOrk Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted October 29, 2010 Share Posted October 29, 2010 just out of curiosity, do lua scripted emitters work for you? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted October 29, 2010 Share Posted October 29, 2010 Yep, LUA barrel with fire forks fine. I want to make transparent object with C++ PS: C++ and framework, if possible: i dont want to invent my "brave new worlds". Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 29, 2010 Share Posted October 29, 2010 Having looked at the Wiki page on Framework your previous code looks correct: SetWorld(GetLayerWorld(GetFrameworkLayer(1))); So assuming this is not bugged is there an issue with your mat file or the texture itself? What exactly are you seeing when the emitter runs ? Transparent areas being rendered non transparently ? Do you have a graduated transparency or are the transparent areas 100% transparent in the texture? Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted October 29, 2010 Share Posted October 29, 2010 I see something like this I use: SetWorld(GetLayerWorld(GetFrameworkLayer(1))); TEmitter emitter = CreateEmitter(20,800,Vec3(0,0.2,0),1, _parentEnt); PaintEntity(emitter, g_gunSmoke); SetEmitterRadius(emitter,0.005,0.1); EntityColor( emitter,Vec4(1,1,1,0.1) ); SetEmitterRotationSpeed(emitter,0.1); SetWorld(GetLayerWorld(GetFrameworkLayer(0))); PS: about smoke appearance point i ask in this thread ( http://leadwerks.com/werkspace/index.php?/topic/3036-getvertexposition-usage/ ), but this is another thread Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 30, 2010 Share Posted October 30, 2010 Well although I've never used framework that code looks ok. However, the pic you've attached shows transparency working! Its a strange banded type of transparency which is not ideally suited for smoke but its transparency none the less. You might want to look at the alpha channel in your underlying texture. Does it display the same banded transparency? Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted October 30, 2010 Share Posted October 30, 2010 This smoke looking like on the picture in both cases: if i use SetWorld(GetLayerWorld(GetFrameworkLayer(1))); or if i comment it. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 30, 2010 Share Posted October 30, 2010 Sorry but I have no idea what's going on then. If your texture and mat file are ok then either framework is broken or something else in your code is interfering with this for some reason. I believe alpha test (only full on transparency) works in the main world but alpha blend (graduated transparency) requires the transparent world to render correctly. I think you need to talk to someone who is using framework rather than framewerk to confirm transparent emitters are working correctly for them. Then maybe they could try your mat and texture files. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
VeTaL Posted October 30, 2010 Share Posted October 30, 2010 I'm using just a standard smoke files... Looking like i need to go back to framewerk from framework. Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted October 31, 2010 Share Posted October 31, 2010 Hey... Is it really framework so useless? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted November 5, 2010 Share Posted November 5, 2010 Heeeey... How can i get access to transparent world in Framewerk? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted November 6, 2010 Share Posted November 6, 2010 thanks to Deluvas for his time, trouble was in old assets that i used in my main project (i think that, because i created new test scene and got sprites to work) Quote Working on LeaFAQ 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.