Jump to content

nick.ace

Members
  • Posts

    647
  • Joined

  • Last visited

Posts posted by nick.ace

  1. Well && isn't a bit operation, but were you setting a variable with &? I wish that the code for the model shaders used bitwise operations instead of addition because I think it would make more sense.

     

    What I was saying about subtracting was mainly if the total of the flags was less than ten. For example (using 8 bits instead of 32-bit int):

    2 - 10 = -8

    0000010 - 00001010 = 11111000

     

    Now, you just checked a bunch of flags because the lighting shader uses bitwise operations to check for flags rather than subtraction.

     

    So far, there isn't a wiki page on it, but I can make one. Also, if you or anyone else wants me to make tutorials, I can do that. IDK how useful people find them. They do take time to make, but I like doing it, just not sure how good they are because I haven't gotten a lot of feedback.

     

     

    Edit:

    Just created a wiki page:

    http://leadwerks.wikidot.com/wiki:shader-specification

    • Upvote 1
  2. Ok, my bad. The material flag has to contain a 2 to be selected. Don't subtract 10 though. You should be using bit operations or else you can go negative and cause a bunch of flags to be checked by accident. You can just set the alpha channel to 0, but I would just see what the example shaders do since they include a bunch of other useful flags. Don't comment it out though because then the lighting gets screwed up because the normals are needed for good lighting.

  3. Yeah, no problem! I don't actually show how to alter the lighting shader in a tutorial, but I mentioned it in a video because it took me forever to figure out why everything was red when I was overriding Leadwerks lighting lol. That's a very Leadwerks-specific thing though.

  4. fragData1 is the normal buffer. The alpha channel for the normal buffer is used to store flags such as selection state and decal stuff. Are there any other fragData1's being set? I thought that by default if you didn't write to it, the unselected state flag wasn't set (so it would be selected) because in my lighting tutorial I remember having to modify the lighting shader in order to prevent this from happening. Maybe that changed though.

    • Upvote 1
  5. Without looking at the GLSL code, it's probably not setting the material flag correctly. Look at the examples for model shaders. Without this flag explicitly set, the lighting shader will by default assume that it's "selected." This is actually how objects are colored when you select them in the editor.

    • Upvote 1
  6. The probes aren't dynamic, so you won't be able to see the player. The SSLR shader won't work because the back of the player will be culled in a third person game and hidden in a first-person game. Basically, you can't use that shader for anything that's not currently displayed on camera.

  7. Yeah, your method is how I would do it as well. The double rendering is too expensive, and you can customize object appearances better. Generally, you want things on your minimap to be highlighted (enemies, objects, players, etc.), which double rendering wouldn't be great at. I don't think I've ever seen an actual minimap done with the render to texture method, but I could be wrong. On thing you may want to think about though is avoiding too many draw calls to images though. I don't imagine it being an issue, but if you have hundreds or thousands of images in your minimap, you're going to be doing a ton of overdraw, and have performance issues there as well, but I would think that it's better than double rendering still. In those extreme cases, you would probably use a 2D array with some type of custom shader to do that, but for most games I don't see that being an issue.

    • Upvote 1
  8. But hidden entities won't cast shadows, will they?

     

    How do you get your shadows from the first world render on top of the render from the second world?

     

    You don't actually hide the entity. You just use a garbage shader that tosses out the fragments on the model, but use a legit shader for the shadows in the main world. In the first-person model world, you would just render the mesh with shadows again (or without, but you may need self-shadowing). You would have to render the model twice (one in each world) but it shouldn't be a huge deal.

  9. Yes,

     

    Examples:

    - Traffic tools

    - UI builder tools

    - AI waypoint tools

    - AI behavior trees

    - Animation blending editor

    - Road tools

    - City generation

    - LOD tools

    - New importers/exporters

    - Terrain generation

    - Mesh editors

    - etc.

     

    Some of these were an issue for me specifically. Unless you want to use pivots for all of those. I couldn't even use my own traffic system at a certain point once I had 500 pivots lying around and have to connect them all through the script parameters! Besides, if you depend on a plugin, you know the risks. Also, right now you have a bunch of UI libraries because there's not a great single way to do it (let me clarify: they're all great, it's just they lack an interface in the editor, so some creative was involved). Wouldn't it be cool if all of those libraries were consolidated? The thing is that the map file format doesn't need to be different. The biggest problem is the interface for the things I listed.

     

    That's why Workshop code could exist, so you can fix it if anything needs to be changed. Or perhaps have a separate repository for all plugins so that anyone can request pull requests. Not every tool needs to be complicated that it would break either.

     

    Why would you have to maintain your section of MP3 code? That format doesn't change, so the decoder doesn't change. The playback shouldn't change either.

  10. Why don't you just render the first-person model with a material that has shadows but discards the fragments of the model in the normal shader? Then, you get the best of both worlds.

     

    Personally, I would do what Josh suggested though. If you decide to use environmental probes, you're going to be in trouble.

  11. I would have written my Trafficwerks code as an extension if it was supported. Right now, the only thing you can do to mimic extensions is to use pivots (e.g., Aggror's GUI tool). I mean people upload to the Workshop for free all the time, and there are many downloads there. Plus you can make some cool tech demos with extensions. :)

  12. Ah ok, I didn't know there were no hooks or anything for leaving an entity. Why not program a box intersection test yourself though? Then you'd have as much control as you would need. You would need to scan through all entities at startup and then calculate the highest +x, -x, +y -y, +z, and -z values for the vertices of a mesh.

     

    You can remove elements from a vector. You should just swap the element you want to remove with the last element and use pop_back(). Don't use the erase() method though. A vector is just an array behind the scenes whereas a list is not.

  13. Isn't the AABB box supposed to not be used for collisions? There's nothing really you can do about that. Personally, I would just use collisions for triggers. Otherwise, use some quick rectangular prism intersection test.

     

    In terms of the loop efficiency, it's hard to determine whether that would be a good setup or not depending on the application. But there are probably better techniques to use. You could use a KD-tree so that you don't need to test every entity. IDK how costly it is to set up each frame compared to your list approach though. I wouldn't use the "list" data structure. Use "vector" instead if you are going to use a list like you are using. With "list" you are going to be building a chain of pointers, so you will have fragmented memory and get more cache misses, so your loop will be less efficient.

     

    Also, I would avoid using GetDistance() and just square the second term. Implement your own distance function without the use of square-root.

×
×
  • Create New...