-
Posts
3,946 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by macklebee
-
eh its a fun little tool but nothing that you could not do with the current LE Shader Editor. stating the obvious but don't expect to be able to plug the shader code directly from this into LE and expect it to work without modifications.
-
No - world rendering does not need that. The examples where they were clearing the context was just a simple way to clear the screen to prevent smearing of variable or moving 2D items like text or rectangles but those same examples do not have a world being rendered. When the world is rendered it will overwrite every pixel in its context/buffer - effectively "clearing" the last render or 2D item drawn.
-
you are clearing the context which will remove the world render from it...
-
For what you are doing though you could probably get away with just setting the buffers size ratios to be the same and camera FOV to create a zoomed in look. The intention with that shader modfication was more for just controlling what parts of a texture image to show. In your case, since you are already doing a buffer, then i would do it the way we did in LE2 and just control the size of what was being drawn to the buffer.
-
well the intention of that shader modification was for the "clipcoords" uniform to be used in conjunction with the "scale" uniform to control what is being shown on the screen. Also remember that the "clipcoords" is in units from 0 to 1. So with clamping in effect when you set the clipcoords then you would have to scale the image to fill the rest of the buffer or you will get a smeared image filling the rest... Also, I should have updated that post but I found that multiplying the texcoords by the scale and then adding the clipcoords resulted better in what was intended... so the shader line should look like this: fragData0 = drawcolor * texture(texture0, (vTexCoords0 * scale + clipcoords)); and this is an example program to try (keeping in mind its still based on the drawimage shader modified): function App:Start() self.window = Window:Create("example",0,0,800,600,Window.Titlebar+Window.Center) self.context = Context:Create(self.window) self.world = World:Create() self.camera = Camera:Create() self.camera:SetPosition(0,0,-3) self.light = DirectionalLight:Create() self.light:SetRotation(45,45,0) self.buffer1 = Buffer:GetCurrent() self.box = Model:Box() self.box:SetColor(1,0.5,0,1) self.buffer2 = Buffer:Create(self.context:GetWidth(),self.context:GetHeight(),1,1) self.texture = Texture:Load("Materials/Developer/bluegrid.tex") self.texture:SetClampMode(true,true) self.shader = Shader:Load("Shaders/Drawing/drawimage.shader") self.buffer2:Enable() self.shader:SetVec2("clipcoords", Vec2(0.5,0.5)) --start drawing at center of image self.shader:SetVec2("scale", Vec2(0.5,0.5)) -- scales the UV coords by 2 self.context:DrawImage(self.texture,0,0,self.buffer2:GetWidth(),self.buffer2:GetHeight()) self.shader:SetVec2("clipcoords", Vec2(0.0,0.0)) --set back to default self.shader:SetVec2("scale", Vec2(1.0,1.0))--set back to default self.buffer1:Enable() return true end function App:Loop() if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end self.box:Turn(Time:GetSpeed()*0.5,Time:GetSpeed()*0.5,0) Time:Update() self.world:Update() self.world:Render() self.context:SetBlendMode(Blend.Alpha) self.context:DrawImage(self.buffer2:GetColorTexture(0),550,350, 200, 200) self.context:Sync(); return true end
-
actually it was Marley who had shown me a working example of enet via ffi in the lua version a couple of months ago... but since he isn't around at the moment i will take his "likes"
-
see here: http://www.leadwerks.com/werkspace/topic/10809-lua-drawing-a-tiled-image/#entry79259
-
yes ffi is working in the lua only version as long as sandboxing is disabled.
-
hmmm weird - it works fine for me Edit- no, youre right. The created animated sprite sheet prefab works only if you break it and make it a non-prefab.
-
Look at this as it may help answer a lot of your questions: LE FAQs
-
sprite sheet texture used with emitter prefab: probably could be spruced up with some trailers shooting out at random directions...
-
PhysicsSetPosition() failed probably because the entity had no mass. How are you updating the position of the sphere? Either code or an example demo would be helpful. Also, another way to troubleshoot is to use camera:SetDebugPhysicsMode() to see how the physic shapes are moving and are located where you expect them. And to what Einlander was suggesting - a csg primitve without mass or a script, and the engine will think the csg is a static entity and I believe try to optimize it into one mesh along with other static csg's with no script (but that might just apply to the editor and loaded maps - can't say for sure as the documentation is lacking in this area). So add a mass and since you don't want it to be affected by gravity, use entity:SetGravityMode(). Then to prevent SetPosition() from possibly breaking the physics, try using PhysicsSetPosition().
-
how are you updating the position of the invisible sphere? If you are using entity:SetPosition(), it may be breaking the physics. You could try using entity:PhysicsSetPosition()
-
should be as simple as discarding the pixel if the alpha falls below a certain level... so after the line here: //Modulate blend with diffuse map outcolor *= texture(texture0,ex_texcoords0); add this line: if (outcolor.a<0.5) discard; granted this may require you to edit the original diffuse texture to lower the alpha in the areas you wish to discard
-
so something like static Model* Load(const std::string& path, int flags=0, const uint64_t fileid=0, Source *source=null)? or would it be easier to have something like entity:SetSource() / entity:GetSource()? granted your way would solve the problem as long as all the available model entities have this overload... and it would basically remove the need for EmitSound()
-
unfortunately we dont have access to that in lua but hopefully Josh will see the post and see the need to add this
-
In LE2's lua, the source was the entity emitting the sound as the command would return a TSource source = box:EmitSound(sound,5,1) unfortunately, it appears that no longer works... sounds like a good thing to bring up in the suggestions... or at least a need for an entity:GetSource() command
-
Yes, after seeing a provided fbx model, it is missing texture coordinates/UV's completely. Possibly missing an export selection when exporting to fbx? What is your modeling app? i am sure there is someone here that has experience using whatever modeling app you are using that could help show what step you are missing.
-
if he has to do that then he might as well just draw straight to the context and not worry about prespective versus ortho or creating a custom quad as the engine already provides that with the inherent 2D Draw commands The only other thing i could think of is to modify the 2D drawing shaders to rotate the vertices to get the rotated look he was going for... again though, probably making it more difficult than needed when it might be easier to just create the images to have a 3D askew look to them
-
I suspect the face that looks smeared on the model has its UV not properly laid out/flatten and the edges of the UV are on top of each other. Most 3d modeling programs will allow to you to pick the corresponding UV by picking the model face in question... you could try that to make sure that the model has been properly unwrapped. Edit-- just out of curiosity which face on the model are you referring to? because offhand I cant tell from the textured UV screenshot because some of the textures being used look like what happens when textures are stretched from UV scaling...
-
you may have missed my edit - but the default material blendmode is solid, try changing it to alphablend and you should get your transparency assuming its above the alphamask shader's discard level. as for the shader - it may be from Marley's Ghost who provided this missing shader... its been awhile, so if its not in your version, its because it was custom made... but if thats the case then simple shaders like diffuse+alphamask and diffuse+normal+alphamask shaders for static and and animated models seems to be lacking in the engine.
-
odd - I have that file and as far as I am aware that's not just limited to the beta. are you sure you dont have that file? There's no probably about it. The shader is discarding anything that has an alpha less than 0.5. You would need to increase the alpha for any image above 0.5 via a 3rd party texture editor or in the case of just DrawRect(), use context:SetColor() with an alpha above 0.5 but less than 1.0. If you are unable to edit your own textures via gimp, paint.net, photoshop, etc, then you could try changing the shader to discard at a lower alpha level to see if that improves your results. Edit- you could try setting the material's BlendMode as the default is to draw the material as a solid blendmode which would prevent any transparency from occurring for images/rectangles rendered onto the plane.
-
Sounds like you don't have your models properly UV mapped. Can you show a screen shot of your UV's? As always, without seeing an actual item in question whether it be a model or code, the best anyone can do is just guess. Please provide an example model that shows this behavior preferably in fbx so we can try it ourselves.
-
both would make the plane invisible but setting the material color to a low alpha may prevent anything else from showing up... Here is the example code reworked using the alphamask shader. Note that i had to clear the buffer color as a way to refresh or else i would get smearing. The previous example i was just drawing a solid rectangle over the entire buffer. function App:Start() self.window = Window:Create("dynamic material example",0,0,800,600,Window.Titlebar+Window.Center) self.context = Context:Create(self.window) self.world = World:Create() self.buffer = Buffer:GetCurrent() self.camera = Camera:Create() self.light = DirectionalLight:Create() self.light:SetRotation(45,45,45) self.box1 = Model:Box() self.mat1 = Material:Create() self.shader = Shader:Load("Shaders/model/diffuse+normal+alphamask.shader") self.mat1:SetShader(self.shader) self.shader:Release() self.box1:SetPosition(0,0,2) self.box1:SetMaterial(self.mat1) self.box = Model:Box() self.box:SetColor(1,0,0,1) self.box:SetPosition(0,0,4) self.mybuffer = Buffer:Create(100,100,1,1) return true end function App:Loop() if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end self.box1:Turn(Time:GetSpeed()*0.5,Time:GetSpeed()*0.5,0) self.box:Turn(-Time:GetSpeed()*0.5,-Time:GetSpeed()*0.5,0) Time:Update() self.world:Update() Buffer:SetCurrent(self.buffer) self.world:Render() Buffer:SetCurrent(self.mybuffer) self.context:SetColor(1,1,1,0.4) self.mybuffer:Clear(Buffer.Color) self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1,1) self.context:DrawText(string.format("FPS: %.2f",Time:UPS()),15,40) self.tex = self.mybuffer:GetColorTexture(0) self.mat1:SetTexture(self.tex,0) self.context:Sync(true) return true end
-
Not being able to see your code, I am just guessing that you are assigning a simple diffuse.shader to the plane like I did in that example code. You need to assign a shader that allows for transparency and discards pixels based on the alpha value. It looks like the only inherent shader available would be the diffuse+normal+alphamask.shader. So just set the color to have an alpha value less than 0.5 for the background color and it should be discarded. Make sure when drawing your textures to increase the alpha back above 0.5.