Converting png/jpg to KMG - garbled output when pvr updates

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
User avatar
bogglez
Moderator
Moderator
Posts: 578
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by bogglez »

Looking at the code in your screenshot: Why don't you pass sprite to draw_raster()?
You already looked the sprite up in draw_sprite_raster(), now you repeat this work height times in draw_raster().
Suppose the sprite is number 50 in your sprite sheet and 32 pixels high, then you're doing 50*32=1600 string comparisons every frame when drawing that one sprite.

And you can change the palette by line? I didn't know that. I thought I had tested it in the past and it didn't work. I thought the palette persists through the whole frame?
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Apr 27, 2006 10:15 am
Has thanked: 27 times
Been thanked: 35 times

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by ThePerfectK »

bogglez wrote:Looking at the code in your screenshot: Why don't you pass sprite to draw_raster()?
You already looked the sprite up in draw_sprite_raster(), now you repeat this work height times in draw_raster().
Suppose the sprite is number 50 in your sprite sheet and 32 pixels high, then you're doing 50*32=1600 string comparisons every frame when drawing that one sprite.
it was a dirty test to get it working, I've already cleaned up the code :P
And you can change the palette by line? I didn't know that. I thought I had tested it in the past and it didn't work. I thought the palette persists through the whole frame?
well, I can simulate changing the palette by line in any case. I'm drawing a bunch of thin polygons, and can switch which palette each polygon is drawn with. Part of the reason I wanted 64 16 color palettes instead of 4 256 color palettes was so I could sacrifice half of my palettes to underwater shades. I have my "underwater palette" set at 32 palette entries beyond the original, so if I want to switch between the two I just add 32 to the current palette number.

I'm working on drawing a rolling sin-wave patterned background at the moment, once I get that going, I'll show an example of the water trick I'm doing.
Still Thinking!~~
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Apr 27, 2006 10:15 am
Has thanked: 27 times
Been thanked: 35 times

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by ThePerfectK »

All sorts of effects in this frame lol:

Image

In this case, I have the line scroll going on a transparent foreground texture that is displaying over a sprite that I'm rotating whose palette I've manually set. Next up, I'm going to show that palette swap mimic, maybe I'll package it all together in a small demo people can download. The foreground layer is also tiled in case it's not obvious :D
Still Thinking!~~
Chilly Willy
DC Developer
DC Developer
Posts: 414
Joined: Thu Aug 20, 2009 11:00 am
Has thanked: 0
Been thanked: 2 times

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by Chilly Willy »

That's pretty damn slick! Just shows that even without a special 2D coprocessor, you can still do some slick 2D stuff. Just takes more elbow-grease on the part of the programmer. 8-)
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by bogglez »

For shear effects you can just use a simple rectangle and offset the bottom points on the x axis while leaving the texture coordinates alone btw
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Apr 27, 2006 10:15 am
Has thanked: 27 times
Been thanked: 35 times

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by ThePerfectK »

bogglez wrote:For shear effects you can just use a simple rectangle and offset the bottom points on the x axis while leaving the texture coordinates alone btw
That's if I want linescroll to be uniform and every line, however. If I want a variable width line scroll, like the tricks they use in Axelay, I'd have to chop the quad up into several chunks per linescroll.
Still Thinking!~~
User avatar
ThePerfectK
Insane DCEmu
Insane DCEmu
Posts: 147
Joined: Thu Apr 27, 2006 10:15 am
Has thanked: 27 times
Been thanked: 35 times

Re: Converting png/jpg to KMG - garbled output when pvr upda

Post by ThePerfectK »

Still at it:

Image

My first version of this effect ran at 15 fps. I've got it to a full 60 fps now.

It's going in steps in this picture, but I can make it go as smooth as the original pic, except 4 times as fast :D
Still Thinking!~~
Post Reply