Gilmer Posted April 26, 2010 Share Posted April 26, 2010 Well, my objective is to create a texture that update dynamically. A cubemap dynamic, for example. Each face of this texture, will have 256x256. I did the following, I took a shader, which mounts the cube map, from a 1536x256 texture. Being a face side by side, so I need updating this texture. I want to do so, put the camera in the center of the object, render, and place the rendered texture (256x256), in the buffer that I created that has 1536x256. So rotate 90 degrees to the camera, rendering, and position in the buffer on the side of the texture you created earlier. So it goes ... But the problem is the rendered image is not rendering the skybox. Only the models around. Is there any command that I need to upgrade to, or set it? Here's a picture of my scene. The camera to render this is inside the box: And the code used in the box model: require("scripts/class") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") local class=CreateClass(...) fw=GetGlobalObject("framewerk") function class:CreateObject(model) local object=self.super:CreateObject(model) cameracube = CreateCamera() CameraClearMode(cameracube,1+2) CameraClearColor(cameracube,Vec4(255,0,0,0)) cameracube:SetPosition(model:GetPosition()) cameracube:Hide() rotcam = cameracube:GetRotation() --main camera maincamera = fw.main.camera -- buffers mainbuffer = CurrentBuffer() buffercam = CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4) --bufferlight = CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4) buffertex = CreateBuffer(256*2,256,1+2+4) --buffertex2 = CreateBuffer(256,256,1+2+4) function object:Update() model:Hide() cameracube:Show() maincamera:Hide() --Visao1 cameracube:SetRotation(rotcam) SetBuffer(buffercam) RenderWorld() RenderLights(buffercam) colorbuffer = GetColorBuffer(buffercam) SetBuffer(buffertex) DrawImage(colorbuffer,0,256,256,-256) --Visao2 cameracube:Turnf(0,90,0) SetBuffer(buffercam) RenderWorld() RenderLights(buffercam) colorbuffer = GetColorBuffer(buffercam) SetBuffer(buffertex) DrawImage(colorbuffer,256,256,256,-256) SetBuffer(mainbuffer) colorbuffer3 = GetColorBuffer(buffertex) colorbuffer4 = GetColorBuffer(buffertex2) cameracube:Hide() maincamera:Show() DrawImage(colorbuffer3,0,256,256*2,-256) --DrawImage(colorbuffer4,0,512,256,-256) Flip() model:Show() end end And as I do for the texture image rendered, not flashing on the screen there? Thanks all (I posted here, why do not know what would be the most appropriate place for this doubt) Quote Link to comment Share on other sites More sharing options...
Joh Posted April 26, 2010 Share Posted April 26, 2010 Do you use Framework? If yes skyboxes is in another world. Backgorund if i don't remeber wrong. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Gilmer Posted April 26, 2010 Author Share Posted April 26, 2010 ok, but how can I access the background of framewerk? And one question, how do i change a texture, which is inside the file.mat? For example, in the file, is this: "texture0=reflect.dds" How i can create a texture, but the shader always update the new texture?? Thanks Joh... Quote Link to comment Share on other sites More sharing options...
Gilmer Posted April 27, 2010 Author Share Posted April 27, 2010 no one? I need to know how I do to render the skybox from the background of framewerk, through a file .lua of some model. I already tried a lot of ways but I can not, the documentation is not very explanatory: fw.main.world.GetBackground().. fw.background.... how?? Quote Link to comment Share on other sites More sharing options...
Joh Posted April 27, 2010 Share Posted April 27, 2010 Well you could be able to do it, just changing the world goes on BG paint the buffer, so change the world again paint the buffer and find a way to merge the 2 image. Wich color you get where should be the skyboxes? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Gilmer Posted April 27, 2010 Author Share Posted April 27, 2010 Here is the problem .. So, I try to reformulate my question, I do not speak English very well, I guess I'm not getting play me right ... hehehe I have two cameras on the scene, one is the framewerk, which normally created in the editor, and the other is one I created the script .lua of model. But the problem is that when i send rendering some image created by the camera, it renders everything except the skybox. The visions they are having: What function should i use to be able to show the skybox on the second camera? thanks joh Quote Link to comment Share on other sites More sharing options...
Josh Posted April 27, 2010 Share Posted April 27, 2010 I would call fw:Render() a second time and move the camera. 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...
Joh Posted April 27, 2010 Share Posted April 27, 2010 What i am tryng to explain is that you use framewerk wich have 3 worlds in total.. With your cam you don't renderize those worlds, so the cam won't be able to see them. RenderWorld() With this command you renderize only the current world, so you will probably fix the problem when you'll renderize every world in the correct order.. So it should be BG, World and transparency. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Gilmer Posted April 28, 2010 Author Share Posted April 28, 2010 Thanks Joh and Josh. I managed to solve the problem.... thanks Quote Link to comment Share on other sites More sharing options...
Josh Posted April 28, 2010 Share Posted April 28, 2010 In the future, I want to implement a feature I am calling "stages". This will allow you to define a stage for an entity or material, and then render a camera one stage at a time, with your own code in between to handle effects. Something like this: camera.BeginRender(); camera.Render(-1);// draw skybox camera.Render(0);// draw main stuff //Do whatever post-processing stuff you want camera.Render(1);// draw transparent objects camera.EndRender(); This would eliminate the need for multiple worlds and multiple camera renders. 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...
enablerbr Posted April 28, 2010 Share Posted April 28, 2010 Josh do you mean something similar to the way XNA does it? Initlize(),Update(gametime),Draw(gametime) methods. Quote Q6600, GTX 560Ti, 8GB DDR2, Windows 7 Home Premium 64-bit. Link to comment Share on other sites More sharing options...
Flexman Posted April 28, 2010 Share Posted April 28, 2010 Stages sounds like a nice way to do things like Megaparticles which I was having a look at recently. Plus it would make my cockpit problems go-away if you could reset the camera matrix back to zero for a final stage. camera.Render(1);// draw transparent objects MatrixReset(camera); camera.Render(2);// draw cockpit object camera.EndRender(); Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
Josh Posted April 28, 2010 Share Posted April 28, 2010 Josh do you mean something similar to the way XNA does it? Initlize(),Update(gametime),Draw(gametime) methods. I don't know how XNA works, but that does not sound like what I am describing. 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...
Josh Posted April 28, 2010 Share Posted April 28, 2010 Stages sounds like a nice way to do things like Megaparticles which I was having a look at recently. Plus it would make my cockpit problems go-away if you could reset the camera matrix back to zero for a final stage. camera.Render(1);// draw transparent objects MatrixReset(camera); camera.Render(2);// draw cockpit object camera.EndRender(); That's pretty clever, but how would you blur the depth buffer of the particle image? I do like that idea a lot. It makes sense to render the shape of the volume first, and then make it look like particles after. 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...
Guest Red Ocktober Posted April 30, 2010 Share Posted April 30, 2010 for Joh... wiki worlds explained with functions use something like this... SetWorld(FG) RenderWorld() SetWorld(BG) RenderWorld() ... i think. good luck... --Mike Quote Link to comment Share on other sites More sharing options...
Joh Posted April 30, 2010 Share Posted April 30, 2010 For me? I don't need it Gilmer needs but seem he solve the problem. In the future, I want to implement a feature I am calling "stages". This will allow you to define a stage for an entity or material, and then render a camera one stage at a time, with your own code in between to handle effects. This seem smart. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted April 30, 2010 Share Posted April 30, 2010 OOOOOOOPPPS!!! sorry... thought you were the original poster asking the question Joh... racing through 3 different forums and paying attention to a render in progress on the other machine... --Mike Quote Link to comment Share on other sites More sharing options...
Joh Posted April 30, 2010 Share Posted April 30, 2010 Don't worry man i understood! Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. 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.