That's quite possible because most 2D engines are built to overcome some of the pitfalls that are common to 2D games using 3D accelerated graphics. Also, if memory is an issue, then most 2D rendering engines will use less memory than a 3D rendering engine for certain things. [/code]Ulf wrote: Hehe. I get your point. But I meant that making a 2D game engine with a 2D renderer requires less than a 3D game engine with a 3D renderer. Just purely that a 2D game engine is simpler.
ITexture to IImage conversions are slow
If you really want to understand how an orthographic camera works versus a perspective projection camera, then this is recommend reading: Deriving Projection Matrices.
TheQuestion = 2B || !2B
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
if the plane normal is presented toward the camera, yes. You you created a 3D box, then then normal facing the camera will render that face.Ok. I can see that. So, forgive my naivety but, when rendering with an orthographic camera with 3D quads, does that mean that only the plane facing the camera will be rendered (2 triangles per sprite)?
If you really want to create a 2D engine (using the hardware acceleration of modern video cards), you use an orthographic camera (no perspective) and use only textured planes (a simple quad poly). You could think of this as a mario "paper" thing. So your 2D game can have "3D" effects if you like.
Why? Don't you use an alpha channel? I could do a sprite of 480x240, define a transparent background in photoshop as 512x256. Don't want to use transparency in your sprites?I want non power of 2 textures.
I am using non power of 2 textures with IVideoDriver::draw2DImage.
AS for IRRlicht not doing 2D hardware acceleration, it's more of a hardware related thing. Get back a old 3DFX card. All modern card focus much more on 3D acceleration. Vista/Linux is even GUI accelerated in OpenGL/DX and they still look 2D, but using the 3D hardware acceleration with simple planes to have their GUI drawed.
Thank you Halifax. I'll look.Halifax wrote: If you really want to understand how an orthographic camera works versus a perspective projection camera, then this is recommend reading: Deriving Projection Matrices.
Ok. Thank you Christian.christianclavet wrote: if the plane normal is presented toward the camera, yes. You you created a 3D box, then then normal facing the camera will render that face.
If you really want to create a 2D engine (using the hardware acceleration of modern video cards), you use an orthographic camera (no perspective) and use only textured planes (a simple quad poly). You could think of this as a mario "paper" thing. So your 2D game can have "3D" effects if you like.
Why? Can't I use transparency without power of 2 textures?christianclavet wrote: Why? Don't you use an alpha channel? I could do a sprite of 480x240, define a transparent background in photoshop as 512x256. Don't want to use transparency in your sprites?
I've only testing scaling on them, not transparency.
I'm used to the BitBlit functions in windows where you don't need power of 2 textures for transparency.
Yea I actually know this.. I think I'm just doing so many things at the same time that I've been over thinking and confusing myself sometimes. Hyper! But.. I'm settling in slowly...christianclavet wrote: AS for IRRlicht not doing 2D hardware acceleration, it's more of a hardware related thing. Get back a old 3DFX card. All modern card focus much more on 3D acceleration. Vista/Linux is even GUI accelerated in OpenGL/DX and they still look 2D, but using the 3D hardware acceleration with simple planes to have their GUI drawed.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
You should really try to read those answers with a little more motivation for correct understanding. The described way allows for NPOT sprites on every hardware, i.e. even on such hardware that strictly enforces the POT dimensions. If you just don't want to accept suggestions, you should probably stop asking...Ulf wrote:Why? Can't I use transparency without power of 2 textures?christianclavet wrote: Why? Don't you use an alpha channel? I could do a sprite of 480x240, define a transparent background in photoshop as 512x256. Don't want to use transparency in your sprites?
I've only testing scaling on them, not transparency.
I'm used to the BitBlit functions in windows where you don't need power of 2 textures for transparency.
Your statement does confuse me (in relation to christianclavets quote)hybrid wrote: You should really try to read those answers with a little more motivation for correct understanding. The described way allows for NPOT sprites on every hardware, i.e. even on such hardware that strictly enforces the POT dimensions.
christianclavet wrote: Why? Don't you use an alpha channel? I could do a sprite of 480x240, define a transparent background in photoshop as 512x256. Don't want to use transparency in your sprites?
Your quote tells me yes I can use non power of 2 textures when using transparency. From christians quote I thought no I must end up merging it with the power of 2 transparent texture.
Gee I don't sense any sarcasm.hybrid wrote: If you just don't want to accept suggestions, you should probably stop asking...
Don't get me wrong, I still appreciate all the help you have given me
I can practice more and ask less. I'm just getting into it.
All the terms and links that have been thrown at me have helped though, such as NPOT which I'd never heard of.
.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.
I'm not sure if you understand now or not... but I will say anyway:
The point about non-power-of-two textures, is that while they may work fine on *your* video card, they may not work on other people's, not all cards support them (or in the case of mine, it does, but they are rendered horribly). So you probably *should* use power of two textures, and as Christian said you can use transparency to pad out all your graphics to a POT level.
The point about non-power-of-two textures, is that while they may work fine on *your* video card, they may not work on other people's, not all cards support them (or in the case of mine, it does, but they are rendered horribly). So you probably *should* use power of two textures, and as Christian said you can use transparency to pad out all your graphics to a POT level.
Thanks.xDan wrote: I'm not sure if you understand now or not... but I will say anyway
I think I do now (understand).xDan wrote: The point about non-power-of-two textures, is that while they may work fine on *your* video card, they may not work on other people's, not all cards support them (or in the case of mine, it does, but they are rendered horribly). So you probably *should* use power of two textures, and as Christian said you can use transparency to pad out all your graphics to a POT level.
So in effect I MUST use power of 2 textures to ENSURE they will draw properly on ALL video cards. And ... Christian was telling me that I can actually make my sprites (characters, tiles etc) non power of 2 if I want, but I'll have to put it in a power of 2 texture anyway when I draw it (that is if I want to make sure it works on all video cards).
I hope I got it!
So, .. actually I could do it like this if wanted:
I can have a non power of 2 image (bits) inside a power of 2 texture. Then when I want to draw it, I can still draw a non power of 2 section (rectangle) from the power of 2 texture.. and that will work on all video cards.
Am I right?
*EDIT* From what I understand so far it's because the power of 2 thing is just for transformation. You can always blit a single pixel from it but there could be issues with translation to the viewport or it's bounding box since it's actually from a 3D space or it may be rotated.
Something like that??
Thanks for all your help.
Everyone.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
No, you still didn't get it. This is not at all about blitting single pixels, but fast rendering. If you really want to draw pixel-wise, you can do whatever you want. Nothing will be really fast. But if you want to get accelerated rendering, you have to obey to the hw restrictions. And most of the gfx cards require you to put POT textures to get hw acceleration. Otherwise, the texture lookup needs to be made in sw and is slow.
So the solution is that you simply put the non-POT sprite into a texture with POT dimensions, where the non-used area is simply transparent. Then you can render the texture as-is, giving the gfx card a full POT texture, but still get the sprite as desired in some smaller NPOT size.
So the solution is that you simply put the non-POT sprite into a texture with POT dimensions, where the non-used area is simply transparent. Then you can render the texture as-is, giving the gfx card a full POT texture, but still get the sprite as desired in some smaller NPOT size.
I wrote: I can have a non power of 2 image (bits) inside a power of 2 texture. Then when I want to draw it, I can still draw a non power of 2 section (rectangle) from the power of 2 texture.. and that will work on all video cards.
Am I right?
Hmmm. So I can't do that. .... .... I'm not gonna ask more.hybrid wrote: No, you still didn't get it.
It is getting less understood by me.
I was saying/asking if the need for power of 2 for some hardware was so the hardware can do transfrormations properly/accurately. I didn't say this is about pixels.hybrid wrote: This is not at all about blitting single pixels, but fast rendering.
Yea. I guess this is where I'm still making it complicated in my own head!hybrid wrote: So the solution is that you simply put the non-POT sprite into a texture with POT dimensions, where the non-used area is simply transparent. Then you can render the texture as-is, giving the gfx card a full POT texture, but still get the sprite as desired in some smaller NPOT size.
Cause I'm thinking, but I want to draw sections of the texture (not the whole texture). So I can't draw it "wholly" as is.
If my sprite is non power of 2 but sitting inside a larger power of 2 texture (with the sprite fixed to the top left corner of the transparent texture for example), then when I break up my "frames" inside my texture for drawing, all of them are going to be non power of 2, and the right and bottom sections of my texture will be somewhat unused. So I'll be sending the power of 2 texture to be drawn, but I'll be telling it to draw just a non power of 2 section of it.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.
You got the bit about how you should make your sprites correct I think. As long as it works who cares why eh??
Power of two is nothing to do with the transformations. Its only about storing/accessing the texture. If the texture is on the video card, then you will still have problems with non POT even by accessing the texture pixel-by-pixel.
Although, unless you are using a pixel shader, it makes no sense to talk about acessing the texture pixel by pixel as all rendering on the graphics card is done using triangles. The only way *you* would render pixel by pixel would be if you were doing software rendering. (So I guess Irrlicht's software renderer might not have these POT problems - but if you are doing software rendering with 2D graphics in Irrlicht you may as well forget Irrlicht or even C++ and use something a lot simpler!!)
> So I'll be sending the power of 2 texture to be drawn, but I'll be telling it to draw just a non power of 2 section of it.
yeah, that's fine I think. As long as the texture is power of two, then when rendering a quad you can set the UV coordinates to whereever you like within the texture. Have a 1024x1024 texture or something and pack it with all your animation frames.
Power of two is nothing to do with the transformations. Its only about storing/accessing the texture. If the texture is on the video card, then you will still have problems with non POT even by accessing the texture pixel-by-pixel.
Although, unless you are using a pixel shader, it makes no sense to talk about acessing the texture pixel by pixel as all rendering on the graphics card is done using triangles. The only way *you* would render pixel by pixel would be if you were doing software rendering. (So I guess Irrlicht's software renderer might not have these POT problems - but if you are doing software rendering with 2D graphics in Irrlicht you may as well forget Irrlicht or even C++ and use something a lot simpler!!)
> So I'll be sending the power of 2 texture to be drawn, but I'll be telling it to draw just a non power of 2 section of it.
yeah, that's fine I think. As long as the texture is power of two, then when rendering a quad you can set the UV coordinates to whereever you like within the texture. Have a 1024x1024 texture or something and pack it with all your animation frames.
Ok. Thanks xDan. That's what I really wanted to know.xDan wrote: yeah, that's fine I think. As long as the texture is power of two, then when rendering a quad you can set the UV coordinates to whereever you like within the texture. Have a 1024x1024 texture or something and pack it with all your animation frames.
You seem to know something but you don't have this huge ego. Thanks.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.