Explain me how rendering works Created 7 years ago2012-09-07 14:08:05 UTC by rufee rufee

Created 7 years ago2012-09-07 14:08:05 UTC by rufee rufee

Posted 7 years ago2012-09-07 14:08:05 UTC Post #309683
Ok so im messing with opengl with no luck (not a great coder), anyway i cant help but notice that it doesnt give me much control on what i would like to do, the "scene" feels like its the opposite of a normal map - world moves around you not you around... So how does HL's renderer work, how can it use opengl or d3d or software w/o being forced to one or the other ?
Im really frustrated about this. Oh and yeah you are free to discus any rendering thing here.
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-08 04:00:33 UTC Post #309704
the "scene" feels like its the opposite of a normal map - world moves around you not you around
You're right! The world is moved around the camera, instead of the camera around the world. In the end there really isn't a difference, but the linear algebra used to project 3D coordinates onto the 2D screen makes this style more mathematically and computationally convenient.

It wont really make sense until you understand why it has to happen. :P
how can it use opengl or d3d or software w/o being forced to one or the other
OpenGL and DirectX essentially do the same thing, but with slightly different ways of doing things. Their only purpose is to draw triangles with hardware support. Both OpenGL and DirectX have software modes, which means that all of the rendering that normally happens on the GPU happens on the CPU instead.

Renderers that use either OpenGL or DirectX have an intermediary graphics code layer that allows the developers to draw things in an API independent way. For instance they might have a model class. When they want to draw an instance of a model, they only tell it to draw without thinking about how it is being drawn. This draw command then uses code from the the middle graphics layer to draw stuff. It is organized into generic graphics structures and classes like vertex buffers or textures. Based on which graphics API is selected in the options, the objects of the middle graphics layer know the appropriate functions to call from the selected graphics API. OpenGL and DirectX are similar enough that most of the classes and the thought processes behind them are the same for both API's. A lot of the code can be shared, but it's still annoying because everything you support in one API you have support in the other. You have to write all of your API dependent graphics code twice.

As someone who is learning you should focus your efforts on one API at a time. You won't get anything done if you try to write a rendering engine that supports both. That's the kind of annoying stuff you write only if you are being paid to write it, heh. Graphics middle-code isn't fun to write.

I can go into more detail on anything if you want.
TheGrimReafer TheGrimReaferADMININATOR
Posted 7 years ago2012-09-08 06:34:30 UTC Post #309708
What? The world moves around the camera, not the other way round? Mind blown!
Skals SkalsGame / Level Designer
Posted 7 years ago2012-09-08 06:57:33 UTC Post #309709
The world is only transformed around the camera when stuff is being rendered though. Positions aren't actively being moved when the camera moves. That would be nightmarish. :P
TheGrimReafer TheGrimReaferADMININATOR
Posted 7 years ago2012-09-08 07:52:52 UTC Post #309710
So from what i get in hl i don't move at all the engine draws me what i should be seeing ?
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-08 08:16:20 UTC Post #309711
Well that explains why it only draws out polygons you can see at that time, and not everything in the map.
Skals SkalsGame / Level Designer
Posted 7 years ago2012-09-08 08:30:41 UTC Post #309712
Yes it does, but makes it much more difficult for newbies to get started :(
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-08 09:06:38 UTC Post #309713
Posted 7 years ago2012-09-08 09:13:13 UTC Post #309714
Oh i forgot Bruce wasnt particularly welcome here due to serious trolling issues he has. I dont think the daddy of all video games wants to start explaining how to render triangles to me.
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-08 09:24:28 UTC Post #309717
im tired of those trolls and ponies what the fuck they even are

just write him a smart letter with concrete questions, he once wrote me back in 1 hour
Posted 7 years ago2012-09-08 14:02:02 UTC Post #309721
So from what i get in hl i don't move at all the engine draws me what i should be seeing ?
It just depends on how you define "moving". The camera's position and direction moves around the map with your player's position. The part of the map that is drawn is decided by the position of the camera. Once the potentially visible portion of the map is decided that specific chunk of the map is transformed around the camera and drawn.

The camera transformation stuff that has to happen is based on the position and direction of the camera, so I consider myself to be moving with the camera. Don't make it more difficult than it has to be. :P
TheGrimReafer TheGrimReaferADMININATOR
Posted 7 years ago2012-09-08 14:23:26 UTC Post #309722
I mean relative to opengl's camera i dont move an inch in game, but the game moves the world around me so i get the sense that im actually moving but really im not. But now all of a sudden i can move the gl cam this makes it impossible for me to understand.
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-08 14:44:03 UTC Post #309723
What do you consider "I"?
TheGrimReafer TheGrimReaferADMININATOR
Posted 7 years ago2012-09-08 15:46:22 UTC Post #309724
Ingame player perspective.
Il get the hang of how things are done eventually
rufee rufeeSledge fanboy
Posted 7 years ago2012-09-09 02:36:10 UTC Post #309731
Everything is relative really. Does the world really move around you? Does the world really fall upwards and is only held in place by you? It all depends on how you think of it.

If your rendering test is doing the opposite of what you expected, just invert your variables.
Posted 7 years ago2012-10-26 21:59:07 UTC Post #310624
How can you even tell the difference enough to state it?
You must be logged in to post a response.