L B Posted September 27, 2010 Share Posted September 27, 2010 Trying to use refraction with framework, I found myself stuck having to get the rendering buffers, which I can't access. Example: (Reference tutorial: http://www.leadwerks.com/files/Tutorials/CPP/Transparency_And_Refraction.pdf) using System; using Leadwerks; using Math = Leadwerks.Math; namespace Evol { static class Refraction { static void Main() { try { Engine.Initialize(800, 600); Framework.Initialize(); FileSystem.Initialize(@"C:\Users\Lazlo\Desktop\Refraction"); Filtering.Optimize(); Explorer ex = new Explorer(Framework.Camera); ex.Camera.Position = new Vector3(0, 2, -2); Mesh scene = Mesh.Load("abstract::scene.gmf"); World.Current = Framework.Layers.Transparency.World; Mesh sphere = new Mesh.Sphere(); sphere.Material = Material.Load("abstract::glass_refraction.mat"); //sphere.Material.Textures[2] = Can't get the framework's light buffer? //sphere.Material.Textures[3] = Can't get the framework's graphic buffer? sphere.Position.Y = 2; World.Current = Framework.Layers.Main.World; float refractionStrength = 0.01f; while (!Window.HasRequestedClose) { ex.Update(); if (Keyboard.KeyDown(Key.Up)) { refractionStrength += 0.001f; } if (Keyboard.KeyDown(Key.Down)) { refractionStrength -= 0.001f; } refractionStrength = Math.Max(refractionStrength, 0); sphere.Material.Shader.Pass("refractionstrength", refractionStrength); Timing.Update(); Framework.Update(); Framework.Render(); Graphics.Flip(); } } catch (LeadwerksException e) { Debug.Alert(e); } try { Framework.Dispose(); Engine.Dispose(); } catch { } } } } Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted September 27, 2010 Share Posted September 27, 2010 Trying to use refraction with framework, I found myself stuck having to get the rendering buffers, which I can't access. I had the same problem, but because I'm using framewerk and not framework I was able to amend the framewerk adding my own additional functions for suporting refraction. Guess you need to request Josh do likewise in the embedded framework! 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...
L B Posted September 27, 2010 Author Share Posted September 27, 2010 Requested Josh, he said it is not possible at the moment, but that he would try to implement GetFrameworkGraphicsBuffer and GetFrameworkLightingBuffer eventually, which could be in some time. What are your suggested alternatives? Building my own Framewerk, or what? Quote Link to comment Share on other sites More sharing options...
L B Posted September 27, 2010 Author Share Posted September 27, 2010 I actually solved it with this material file: texture0="abstract::glass.dds" texture1="abstract::glassdot3.dds" texture2="tag::rendercolor" texture3="tag::renderdepth" depthmask=0 zsort=1 shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap_refraction.frag" Thanks to Lumooja for the firepit reference suggestion. Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 27, 2010 Share Posted September 27, 2010 Yeah, never judge someone who is marked by experience. He may not be benevolent to your current fashion, but in the end he will show you the right way. 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...
Pixel Perfect Posted September 28, 2010 Share Posted September 28, 2010 So you can reference the color and depth buffers in a material file ... interesting 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...
macklebee Posted September 28, 2010 Share Posted September 28, 2010 yes... as shown in Josh's refraction example that he had provided in the tutorial for transparency and refraction... At the bottom of the tutorial, he even added a scripted model to use inside the Editor. Tutorials are our friends! 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...
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.