Announcement

Collapse
No announcement yet.

Broquen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    using gl2 terminology, your vertex shader takes per-vertex inputs ('attributes'), and writes out 'varyings'.
    the gpu takes those verticies and generates triangles. these triangles are clipped to the screen resulting in a series of 'fragments'.
    your fragment shader is then run once for each pixel within that fragment, taking those varyings (which are interpolated across the various triangle fragments as they go from one vertex to the next). your fragment shader writes out the colour for that fragment's pixel.
    the blend unit takes those pixel fragments and blends them with the value in the current framebuffer, and may still discard parts of the fragment if another fragment wrote a closer value for the depth buffer.

    there are more steps in the pipeline, for instance if there are geometry shaders or tesselation evaluation+control shaders involved, but most people can ignore those still.

    of course, your api might refer to any of these concepts with different names. the basic aproach is the same.

    you might also encounter flat shading, in which case the various primitives use a single value from their 'provoking' vertex without interpolating. the rest of the pipeline doesn't change.

    conceptually, texture sampling is just bolted on the side. think of it as just a subroutine that provides a lookup into a 2d grid, with the sampler saying whether to interpolate or just use the nearest value. your varyings store a colour or a texture coord or a position or really anything so long as its a float(or four, yay simd).
    this is little different from how 'uniforms' work (these started out as individual constants that were sandwedged into the inactive parts of the gpu's fixed-function hardware, but moved to actual blocks of memory once the hardware lost all of its special case transistors). both uniform buffers and textures are just blocks of memory, and modern GPUs can even write back to them.

    the rest is just maths, meshes, and materials. or something.



    basically, figure out the texture coords based upon the world coords, instead of trying to insert geometry which would end up giving you a similar thing with less precision and more overdraw.
    if you want a skybox, use a cubemap. don't draw 6 faces yourself, just give the direction as a texture coord. the gpu will normalize (or squarize or whatever you want to call it) automatically.
    if you want a scrolling 2d sky, project the texture coords into the 2d texture coords yourself. quake projected the sky on a simple flat plane, but pulled closer to 0 the more vertical it got. my glsl should give you a formula equivelent to quake's, but there are multiple other ways to project a flat texture onto a sphere (like a map of the earth).
    calculating the coords in your fragment shader means you will have less overdraw, more precision, and less depth issues/glitches. its also simpler, seeing as you'll have special shaders anyway (assuming you're comfortable writing shaders, but if you're not then you kinda need to learn in order to get any decent effects).
    Some Game Thing

    Comment


    • #17
      @comfortable writing shaders

      I'm just now really wrapping my head around AGAL but, I'm very confident. I'm definitely going to use shaders I just need a little more practice/examples before I start trying to be too advanced. When I get home I am going to work on scrolling the sky on the original brushes. I have seen enough agal to know I will have to create a register constant from an external Array or Matrix and pass it to the program. I haven't messed with that end of agal yet so this task is a perfect case for me to practice. Honestly, I've never met a language that I can't eventually decipher... usually pretty quick. Lol, I keep telling myself I'm done with more languages and I keep having to pound out a couple more in order to get answers or achieve something. From just your one glsl example I put opengl and AGAL basics under my belt In less than 15 minutes. I know both could get substantially harder but, I'll knock that out too when the time comes.

      After I get scrolling sky I'll focus on sphere projection. Thanks for the more detailed reply. I'm moving right along on my understanding.
      Last edited by MadGypsy; 08-28-2016, 12:39 PM.
      http://www.nextgenquake.com

      Comment


      • #18
        At this point, I'm starting to feel like my API is in my way. Don't get me wrong, Away3D is bad-ass period. I could build an "fte" or "darkplaces" in Away3D if I knew what the hell I was doing. Conversely, it's because I do kinda know what I'm doing that it it's in my way. There's something to simply extend some-frikkin-where.

        I'm stuck on C extends B extends A and I need to clone and change all 3 but D explicitly expects C as original B. Making a new D would be insane... I might as well build my own engine API from the ground up. Any attempts to cast new B to original B are futile and probably a terrible solution anyway.

        One way to solve this would be to simply change the API directly but, I hate the idea of fucking with my API permanently. The source isn't wrong it's just not right for as deep as I want to go....
        http://www.nextgenquake.com

        Comment


        • #19


          I'm going to the complete bottom and building my way up. No more away3d or any other API. My example doesn't include it but, I could do textures, secondary uvs and a number of other things with more or less the same concept. I know how to create more buffers, assign all kinds of shader whatnots, properly destroy things and more.

          If I can render 1 polygon any way I want, from the ground up, why can't I render :shrugs: 30,000 of them? The answer is, there is absolutely no reason why I can't. No more API. I know nothing about making an engine from the ground up but, I do have a laundry list of things that I think are pretty damn obvious which need to be classed out. I'm gonna start there.

          I got this little test to work on flash, cpp & neko. HTML5 just gives me a blank screen. That brings me to the next part. I've been doing this backwards this whole time. Instead of trying to shove a quake engine into an api I should have been using the API to figure out how the common stuff is done and using that information where necessary in a quake engine. an example: I just need to track down the obviously somewhere compiler condition for html5 in away3d for rendering and adjust my script accordingly. It's probably something really friggin stupid and simple.

          edit and PS> I know a picture is no proof but, that polygon is spinning on it's center via my matrix & vertex shader. Also, there is only one line in my entire script that is missing in the image above.

          _context3D.present();

          It's the last line. Other than that, that image is the road to the GPU.
          Last edited by MadGypsy; 08-29-2016, 12:29 AM.
          http://www.nextgenquake.com

          Comment


          • #20


            and html5 is fixed. I told you it was something stupid. I didn't even have to dig in away3d. I forgot to add...

            <haxelib name="dom" if="html5" />

            ...to my build file. Now dom library gets compiled into my html5 version and I can use the dom. Yipee.
            Last edited by MadGypsy; 08-29-2016, 12:49 AM.
            http://www.nextgenquake.com

            Comment


            • #21
              I'm making headway. I programmed for 13 hours yesterday. I managed to spin a Mesh, View3D & Material class. Right now it only works on flash. I found the spot that is breaking everything else but, I haven't figured out how to fix it yet. Unfortunately, this isn't really something anyone can help me with as it has everything to do with the internal workings of HaXe. Away3D works on all platforms so, at least I know that what I'm trying to do is possible. I just need to find the "Aha!"

              I'm digging this no API stuff. I may have errors but, I finally feel like I can friggin breathe. Technically, I am still using 1 API OpenFL. I am tempted but skeptical to drop OpenFL and go right off of Lime, which is as low as I can go unless I intend to spin my own GL API.... pbbbt that aint gonna happen, at least not anytime soon. The only real drawback to going down to the Lime layer is EVERYTHING I have done so far will need to be rewritten.. All of it! I'm not just talking about my 3 engine classes. I would have to rewrite my Content/File Manager, All BSP related parsing and everything else. Everything means everything and that's thousands of lines of code. All of my stuff is built on top of OpenFL so I can utilize all the flash stuff that I am super familiar with, at least in a writing code sense. If I attempt to go to Lime it will almost be like learning a new language. The most simple thing like DisplayObject could be something I need to invent myself. OpenFL is built on top of Lime so going down to the Lime layer really only accomplishes one thing...bloat removal but, at the cost of a LOT more work.

              Also, I want to thank Spike for posting that one glsl shader for me to read. If that wouldn't have happened, I wouldn't have had "shader clarity" and I wouldn't have attempted to build my engine from the "ground" up. This is really happening. I have today and tomorrow off. I believe I can get almost 30 more hours of programming in. I can probably even just completely skip sleep til tomorrow night.

              I would post an image of my progress but, I haven't plugged my BSP parser in yet. I know if I did the flash port would work. I wrote my mesh class to gel with how I parse bsp geometry. It should just plug right in. I'm already successfully displaying one mesh, there is no reason to believe adding meshes would be a problem.
              Last edited by MadGypsy; 08-30-2016, 12:49 PM.
              http://www.nextgenquake.com

              Comment


              • #22
                If I went down to the lime level I would be working straight off of this



                What do you guys think? Should I completely cripple myself and drop down to the Lime level? If I do this I end up with the maximum amount of control but, I have no fuckin clue what I am doing. Every little step will be a struggle... for a while. I also lose flash and all of it's rendering unification entirely. In other words this becomes pure OpenGL, no directx (I think) & no software renderer. However, I believe this also means that I can use OpenGl 4 instead of being stuck with OpenGL 2. I'm pretty sure that Stage3D is the only reason I am stuck with OGL2. Without OpenFL there is no Stage3D.

                *I noticed OpenFL and OpenGL looks like I'm making typos. These are 2 different things. OpenFL is Open Flash (ie HaXe implementation of the entire Flash API)
                Last edited by MadGypsy; 08-30-2016, 01:15 PM.
                http://www.nextgenquake.com

                Comment


                • #23
                  Last SPAM

                  I fixed it. It helps if you set the current program BEFORE you set the texture. 2 second fix when I finally opened my eyes. HTML5 and Neko are displaying the image wrong but, I have a good idea why. Wrong image on 2 platforms is better than a crash on 3.
                  http://www.nextgenquake.com

                  Comment


                  • #24
                    Originally posted by MadGypsy View Post
                    What do you guys think? Should I completely cripple myself and drop down to the Lime level?
                    You are learning a lot.

                    But in a random way that you are never choosing what you learn, but instead it chooses you.

                    Having a specific plan or goal and largely sticking with that would prevent that. If your goal is just random learning, there is never an end to that road.

                    And you can't just pick a plan, you have to know WHY that is your plan.

                    "WHY" is the super-power that separates achievers from the rest of the pack. "WHY" results in a clear objective of "WHAT" that then translates to a short list of "HOW".

                    Only you know what you want ... or ... well, ... do you? This is for you to know, not me, and none of my business -- but knowing why you are doing something means knowing what you want. It will give clarity.
                    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                    Comment


                    • #25
                      I know what I want and why. The thing is, I can come in at multiple different levels to achieve the "what". The "why" regarding dropping down to the lowest possible level is real simple. With less between me and the level where the action actually happens the more control I will have.

                      I am trying to find a balance between the level of API I am working on and my skills. As it stands I am at that level with OpenFL. I do not need Away3D to create shaders and geometry for me. However, I'd be willing to bet I wont need OpenFl to create a 3d context for me and assemble my AGAL for very much longer. Especially since once I drop OpenFl, there is no AGAL. I would be as close to native as you can get with glsl shaders and a typical GL to work with. That's really the thing. This isn't about whether or not I know zippola about Lime. I'm a programmer and I guarantee you Lime cannot defeat me, no language can, I don't give a fuck what it is. This is more about completely dropping flash. Even though my "flashy" code has nothing to do with flash when I port to any other platform... all of the functionality without being stuck in the flash VM.
                      http://www.nextgenquake.com

                      Comment


                      • #26
                        @random learning

                        It's not that random. I went from Away3D compiling everything together for me to understanding how they did it and not needing it anymore. Talk about a jewel. I eliminated an entire API in one day. An API that was only doing the most bare bones things for me due to all the other stuff I know. I would hardly call that random learning. If anything it's a shame I had to spend so much time in the API before achieving clarity.

                        I get what you are saying and there is some truth in it but, it's the cynical/jaded way of looking at things. I'm like a few hours from being right back where I already was but utilizing my own API. If that isn't insane progress I don't know what is.

                        Don't overlook the predominant fact here. I successfully threw away a crutch and immediately started walking without it. I'll add that I made all of my classes before testing anything and I only had 1 error and that error was platform specific and it's fixed. You've been programming a long time. How often have you added about 1200 lines of code without testing and only had 1 error? My point here being that I didn't just achieve a little clarity about this level I fully get it! I 1 error in over 1000 lines get it. I flip line 243 with line 244 get it. That was my error. B was happening before A. That's barely an error at all. The lines were correct and right next to each other, just wrong order.
                        Last edited by MadGypsy; 08-30-2016, 02:40 PM.
                        http://www.nextgenquake.com

                        Comment


                        • #27
                          if you go too low level, you end up loosing access to all the portability abstractions that you need for compatibility, which doubles+ the work you'll need to put in.
                          personally I hate 3rd-party dependancies, they just end up annoying one way or another.
                          if its useful, makes sense, and won't slow your finished thing down too much, go with it. the catch is that unless you've been using it a lot, you won't know all the ways in which it sucks (the grass is always greener and stuff like that, hunams are naturally optimistic...).

                          just use the right tool for the job.
                          Some Game Thing

                          Comment


                          • #28
                            I'm going to keep rolling with OpenFl for now but, If I feel like it's getting in my way (like Away3D did) I'm gonna drop it like a hot potato and start over.

                            Anyway, back to work. For the record, I was cooking/eating while goofing off here. I'm done though, so, see ya in like 12 hours or summin.
                            http://www.nextgenquake.com

                            Comment


                            • #29
                              welp, there went the "not one compiler condition" of things. Flash & HTML5 don't like to be resized yet.

                              http://www.nextgenquake.com

                              Comment


                              • #30
                                Originally posted by MadGypsy View Post
                                I'm going to keep rolling with OpenFl for now but, If I feel like it's getting in my way (like Away3D did) I'm gonna drop it like a hot potato and start over.
                                I was going to suggest just that.

                                There comes a point where [the understood] you just has to accept that going 100% from scratch on a project isn't practical in any degree whatsoever. Sure, it's fun and rewarding. But while you're taking baby steps at the Lime level, imagine how much more work you could have done on the engine by the time you actually get back to the point you are at now with OpenFL.

                                Perfect example: I'm a machinist by trade. I like to make parts for customers. But I have zero interest in making the tools, machines, material, or mining the raw ore from the earth to make said materials. I'm ok taking all that stuff as is and plugging onward to make a part. lol.
                                'Replacement Player Models' Project

                                Comment

                                Working...
                                X