Jump to content

Lunarovich

Members
  • Posts

    166
  • Joined

  • Last visited

Everything posted by Lunarovich

  1. Lunarovich

    Up! (Part 1)

    Thanks for this great tutorial. I can't stop repeating that we need official shader manual and tutorials. This one comes as an excellent substitution.
  2. Thanks to everyone! Life would be so much easier with decent documentation and examples...
  3. Ok. Thanx. What I really want is to create some procedural textures. I'm starting to learn how to do it (Perlin noise and such things) and would like to be able to use this knowledge with LE. So, for now, I have, basically, found three possible approaches: Texture::SetPixels. But this function is not exposed to Lua. By using Buffer:Create, Buffer:SetCurrent, drawing to the buffer via Context:Plot and than get a texture via Buffer:GetColorTexture(0) Via shaders. In fact, I have had any success only by using the 2nd method thanks to your example found here. Now, I'd like to know if there is some LE specific way one should go about in order to make procedural textures. Anyway, a default shader is a jungle I cannot get through - no docs, no comments, no nothing! On the contrary, those GLSL tutorials are excellent and simple, and I don't see why it should be so complicated in LE to paint a triangle, with a VBO defined, in red via shaders (btw, I know how to do it by coloring vertices, but that's not something that I want, just for the record).
  4. Hello! As the title points out, I want to know how to color a simple triangle via my own shader. Basically, I want to achieve something like this: I'm trying to recreate, in LE, a tutorial 4 from this excellent resource. So, for the triangle itself, I do something like this: local model = Model:Create() model:SetColor(1.0,1.0,1.0) local surface = model:AddSurface() surface:AddVertex(-0.5,-0.5,0, 0,0,-1) surface:AddVertex(0.5,-0.5,0, 0,0,-1) surface:AddVertex(0.5,0.5,0, 0,0,-1) surface:AddTriangle(2,1,0) surface:Update() model:UpdateAABB(Entity.LocalAABB) model:UpdateAABB(Entity.GlobalAABB) return true With camera and light added (light is probably not needed) and properly positioned, I get a white triangle. I then proceed to create and add a material. Now comes the tricky part. My fragment shader looks like this: #version 400 out vec4 FragColor; void main() { FragColor = vec4(1.0, 0.0, 0.0, 1.0); } However, I have no idea what to do with the vertex shader. If I do nothing with it, nothing gets displayed on the screen in return. Now, I've tried with something like this #version 400 uniform mat4 projectionmatrix; uniform mat4 drawmatrix; uniform vec2 position[3]; void main(void) { gl_Position = projectionmatrix * (drawmatrix * vec4(position[gl_VertexID], 0.0, 1.0)); } but I cannot even get it working when the game starts, since I do not know how to send an array of floats via Lua. A side question: how does one sends an array of floats to a shader via Lua? Anyway, I see that there is no camera matrix transformation concatenated and I do not know how to do it. Any help would be appreciated. Thank you!
  5. Thanks! It occured to me to use also this approach. However, I wanted to see if there is a more direct approach. I'm asking all this because I have an idea of a gameplay based on various postprocessing parameter manipulations - different types of subjectivities manifested via different types of vision.
  6. I see the point. However, if you look at the API, you'll see that Camera:AddPostEffect accepts only string. That said, I cannot first load a shader and send a reference to the shader as a parameter to the camera. Rather, I send a string and never get the reference to the shader back from camera (at least in Lua and as far as I can see). That would probably be the way to control Shadmar's shaders? But can you control stock shaders (ones that come with LE) in the same way?
  7. Hello! I know how to attach post-processing effects to a camera via editor as well as programmatically. However, I do not know how to control post-processing shader parameters dynamically. For example, Shadmar's pixelate shader has this variable: const int downgrade = 6; //at original 1920x1080, 6 yields 320x180 Now, how can I change downgrade value via Lua code? Thank you!
  8. I'm getting into textures right now (thinkering with Substance Designer and procedural textures). So if anyone has an interesting project for the tournament and needs textures for CSG (preferably abstract and SF), feel free to contact me...
  9. Well, if you do not worry about a bad rap, than why should I... Cheers guys!
  10. I just wanted to signal a fact that somebody is using a LE to trick people into installing malware. Follow this link and see.
  11. Hmmm... Besides the water texture in Materials/Water folder, textures in Materials/Effects/Water and water shaders in Shaders/Water folder, I really don't see any prefab/entity/material that would be connected to water. And there is no tutorial how to make water. Could you give me, please, any lead?
  12. @shadmar Thank you! Will try to decipher it, since I'm noob in regards to shaders Anyway, can I (ab)use this opportunity to ask you what happens to your water prefab? I've downloaded it from here, but the water does not seem to move. Just sits there... EDIT The water does not seem to like postprocessor effects. When I turn them off, everything is as expected. Is there a way to have a water with postprocessor effects?
  13. @gamecreator Thank you! The mask will be very handy for my lib. However, neither of what you've said does not correspond to my needs. Firstly, clamping only stretches the last pixel of the texture to it's borders. Secondly, Shadmar made a masking shader and not a shader to draw a part of the image. Althoug, I can use it for those needs, it's complicated and costly workaround. There should be a much simpler way.
  14. I've adapted your shader to my needs. However, I do not see how to clip the image: image just wraps. I see that you use "zoom" in order to clip the rest of the image. However, I want a non scaled part of the image. Any ideas? Btw, I can't find Shadmar's shader that you're talking about. Could you please direct me where to find it?
  15. Hello! Would it be possible in LE to draw only a part of the image on the screen (via context). I mean, let's say I have a 256 x 256 texture with four 64 x 64 frames. Now, I would like to be able to draw, for example, a part of the image with following specs: x = 64, y = 0, w = 64, h = 64. I'm asking that because I'm building a basic 2d graphics lib and would like to implement animation in more elegant manner: right now, I'm just loading bunch of textures as frames, which is cumbersome and not quite efficient from renderer's point of view. Thank you.
  16. I've just impelemnted SetPivot via shaders. It was not possible to do it via SetTranslation, since it translates canvas, so to say, and not an entity. Anyway, you can now have entities rotating about an arbitrary pivot. See Main.lua for examples.
  17. Agree! As far as I've read tutorials, collision detection is explained in the Marble game example. A picking (Raytracing) is absolutely essential to any kind of game, be it FPS, RTS or an adventure. Therefore, a tutorial on picking should be included in the base tutorial set. Just for the record, I was not talking about essentials, but about the polished/professional aspect of the game. And shaders are must in this respect. Anyway, I think that we should be threading the other thread now That of requests...
  18. I agree that it is far more important to have rock-solid basis than advanced development on the shakey ground. Anyway, since we are using now Main.lua, the API docs should also take that fact into account and stop using the obsolete App.lua (eg. this API doc). Not that I cannot do a necessary adaptation myself, but it goes with the territory of rock solid foundations And not that I do not understand that it's not a small task, considering the volume of the API. P.S. Shaders make integral part of LE suite and it would be thus important to have some guide on how to implement them in LE. It's the shaders that make one of the cornerstones of professionally looking games (or at least of that "wow" effect), IMHO, and knowing how to use them in LE (I'm not talking about teaching people OpenGL or shaders) would give us much more community generated shaders. This would give an edge to LE.
  19. Thank you! Will there be any intermediate/advanced tutorial series? For example, how to load/save game (or part of it), or how to load generic files (for example, XML files) and how to parse them. Or yet, how to write shaders LE way, make procedurally models from vertex buffers / triangles and similar...
  20. On the other hand, I don't have an ambition to make a window manager. I just want to implement a barebones solid library that gives us graphical entities, properties and methods out of the box. At this point, I don't even want to implement such things as buttons, menus and similar. For example, I want to have a sprite with a method SetPivot. A nice addition would be to have a nesting hierarchy of entities, so that transformations of a parent sprite get automatically applied to children sprites. Btw, @Einlander, do you plan to release your library? Another question: do you know how one goes to implement pivot?
  21. Cool If anyone has something that is less basic and more consistent than this, it would be great to see it. A community project with contributors and maintainers would be even greater
  22. I've just read your example. It's such a shame that scaling does not work proprely in all cases. I've tested it with DrawImage/Text/Rectangle and it works as expected. Also, I've bumped into problems with SetTranslation cause I wanted to implement variable pivot for the rotation (put the rotation pivot in the center of the image, for example). Although I've done it already in HTML5 canvas, SetScale here does not work in the similar way...
  23. You're welcome Please do signal any bugs or inconsistencies. I feel that it's essential that we have something like this in LE.
×
×
  • Create New...