Jump to content

Lunarovich

Members
  • Posts

    166
  • Joined

  • Last visited

Everything posted by Lunarovich

  1. You got right. I am kind of stupefied by this data:
  2. Thanks. Since OSX consumes a large part of the market, it would be a wise decision to add an export as soon as possible.
  3. Sorry to bump this up, but I can't find nowhere a clear answer to this question: Is it possible to publish a game for Mac OS X at the moment? As far as I can see, it was possible to do it before. But can I do it now, with a current LE version?
  4. I'm using Emacs. With settings that I've made, I have the following features: Auto-complete. I've added a custom-made dictionary file with LE classes and methods. Lua snippeting. I've made several snippeting templates - for generic loops, method definitions, etc. Syntax highlighting and auto-indentation. The latter is very, very useful: it's enforced and you can easily detect missing construct parts. On the fly syntax error checking - so that even before running a LE game, I can tell if there is anything obviously wrong with my code. Plus, in the opposite window, I'm always keeping open a Lua console, so I can easily test various LUA constructs I'm not sure about.
  5. Agree. I'm making some procedural textures ATM. It would be impossible to do such a thing without the use of buffers. And being able to do procedural textures is a top priority for me ATM.
  6. I vote for this one. We definitely need buffer docs!
  7. Thanks! That was quite helpful. I suppose that somewhere down the pipeline we convert materialflags back to bit mask by multiplying it with 255.
  8. Thanks. That makes things a bit simpler. Anyway, I'm still curious about all those lines of code, so an explanation or hint would be appreciated. I'm currently compiling my own notes in regards to how one uses shaders in LE. Maybe I'll put them on blog here, as a newbie guide someday.
  9. Leadwerks recently changed the way the application starts. The entry point of the game was App.lua. Now it's Main.lua. API doc does not yet reflect that change and continues to give examples using App.lua. That said, you can simply create an App.lua (named exactly that way) script in Scripts folder (should be exactly in that folder) and copy paste examples from API doc pages. They should work instantly. Namely, if LE finds App.lua, it treats it as an entry point for your game, for the backwards combatibility sake. Anyway, create App.lua file, copy paste example in it and you should be fine for now. You can tweak the examples in order to understand better how LE works. Hope that helps...
  10. Thanks for this clarification. Then again, models shouldn't be selected by default... And their selection state should not be reflected in any way during the runtime... Anyway, in the default shader, for example, in the vertex part, I see these lines: ex_selectionstate = 0.0; if (vColor.a<-5.0) { vColor.a += 10.0; ex_selectionstate = 1.0; } As far as I can see, the alpha value of the entitymatrix[3][3] (I refer to the entity.matrix[gl_InstanceID]) encodes the selection state of the object. Am I right? I mean, vColor.a is fed with value via vColor=vec4(entitymatrix[0][3],entitymatrix[1][3],entitymatrix[2][3],entitymatrix[3][3]); So, here comes the puzzling part. If this value is less than -5, than we add 10 to this value. Why do we want to change it? I see that ex_selection "boolean" gets the value of 1, which I understand (or I think I understand). Anyway, in the fragment part of the shader, one can read this: int materialflags=1; if (ex_selectionstate>0.0) materialflags += 2; fragData2 = vec4(0.0,0.0,0.0,materialflags/255.0); According to this post, material flag 1 stands for ligthing enabled and 2 stands for decals enabled (reserved; btw, why reserved? what does it mean?). So, if we add 2, material flag will be 3. What does it mean for materialflags to be 3? And finally, if we divide materialflags by 255, even when it's 3, we'll have a value so small that it is barely (if at all) visible to the human eye. What's the point in all this?
  11. Thank you! Finally, the problem was in fragData2. Here is a version of the fragment shader that gives correct results: #version 400 // Outputs out vec4 fragData0; out vec4 fragData2; void main() { fragData0 = vec4(0.0, 1.0, 1.0, 1.0); fragData2 = vec4(0.0,0.0,0.0,0.0); } According to this post, fragData1 stands for normals and specularity, and fragData2 encodes emissivity and something called material flags. As far as I can see it, my material was, for some reason unknown to me, emitting the red "light". I've turned it off by setting every value of fragData2 to 0.0. I've made some tests with fragData2 and it does affect the final color of the model. What I see as a design flaw is this: if you do not specify some color value and material needs it for some reason, the default value should be set to no particular value (black in our case) or to some neutral value (white, in the case of tinting, for example). The default value should not be some idiosyncratic color like red.
  12. As far as I know, there are no hidden docs here. The site has been undergoing significant changes lately. That's why there are some dead links.
  13. Hello! I have this minimalistic quad model: local model = Model:Create() local surface = model:AddSurface() surface:AddVertex(-0.5,-0.5,0, 0,0,-1, 0,0) surface:AddVertex(0.5,-0.5,0, 0,0,-1, 1,0) surface:AddVertex(0.5,0.5,0, 0,0,-1, 1,1) surface:AddVertex(-0.5,0.5,0, 0,0,-1, 0,1) surface:AddTriangle(2,1,0) surface:AddTriangle(0,3,2) surface:UpdateAABB() model:UpdateAABB(Entity.LocalAABB) model:UpdateAABB(Entity.GlobalAABB) In order to shade it, I create a simple material and give it my custom minimalistic shader. Here is the vertex shader #version 400 #define MAX_INSTANCES 256 //Uniforms uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; uniform mat4 projectioncameramatrix; //Attributes in vec3 vertex_position; void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_ = entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position, 1.0); gl_Position = projectioncameramatrix * modelvertexposition; } And here is the fragment shader #version 400 // Outputs out vec4 fragData0; void main() { fragData0 = vec4(0.0, 0.0, 0.0, 1.0); } Now, you should notice that I do not give any special color to the model, material or vertices, and that I set fragData0 to black, so normally, it should be black (and since the background is black also, it should be invisible in this particular case). However, it is red: If I change the relevant line of code to, e.g. fragData0 = vec4(0.0, 1.0, 0.0, 1.0); I get a greenish mix of green and red: Or with fragData0 = vec4(0.0, 0.0, 1.0, 1.0); I get purple, as expected... How can I get rid of this basic red tint? Why is it there in the first place? Thank you!
  14. Ok, here it is, an absolutely minimal model shader... It will output a green geometry... Vertex shader: #version 400 #define MAX_INSTANCES 256 //Uniforms uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; uniform mat4 projectioncameramatrix; //Attributes in vec3 vertex_position; void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_ =entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position,1.0); gl_Position = projectioncameramatrix * modelvertexposition; } Fragment shader: #version 400 // Outputs out vec4 fragData0; out vec4 fragData2; void main() { fragData0 = vec4(0.0, 1.0, 0.0, 0.0); fragData2 = vec4(0.0, 0.0, 0.0, 0.0); } For the explanation of attribs, uniforms and inputs/outputs see this link.
  15. 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.
  16. Thanks to everyone! Life would be so much easier with decent documentation and examples...
  17. 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).
  18. 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!
  19. 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.
  20. 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?
  21. 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!
  22. 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...
  23. Well, if you do not worry about a bad rap, than why should I... Cheers guys!
  24. I just wanted to signal a fact that somebody is using a LE to trick people into installing malware. Follow this link and see.
  25. When I make an image in an external image editor (eg. Inkscape) and put it in the folder inside the project tree, it automatically gets converted to .tex as expected. I open it in the Texture editor and check Clamp checkboxes and do some other adjustments. Now, when I save an image over an original image file, texture gets updated. However, some settings are lost and some are preserved. Namely, Clamp checkboxes get unchecked. This is kind of annoying, since I'm adapting my textures often and have to go everytime to the Texture editor. What is more, it's an inconsistent behavior.
×
×
  • Create New...