pwwit1 Posted March 30, 2022 Share Posted March 30, 2022 Hello, I'm having difficulty understanding how sprite stretching works. In the image below, these 4 sprites (Sizes: 40x40, 32x32, 16x16 and 1x1) have exactly the same tilt and stretch values, but the amount of stretch varies by the sprite size. I've noticed that the stretch value seems to be multiples of the sprite width, which is fine for 1x1 sprites as the stretch and tilt are equivalent at this size. This is a problem because the larger the image the less precision the stretch attribute has. It also seems to contradict the documentation, which says stretch is a 16-bit fixed point value that is added to HSIZE per scanline (Although it does say per 'unit size', maybe 'unit size' is the sprite width?) With 8-bits of precision I should be able to increment the stretch 1/256th of a pixel per scanline, but it seems to increment 1/256th * Sprite Width per scanline. Is this correct behavior, if so, is it possible to create arbitrary polygons with large sprites? Quote Link to comment Share on other sites More sharing options...
42bs Posted March 30, 2022 Share Posted March 30, 2022 (edited) As I tried to explain on discord: STRETCH is _added_ to the SIZE (which is the WIDTH unless SPRSYS B4 = Vstretch is set). Of course it depends on the actual number of pixels: Given a size of $01.00 and a stretch of $00.10 you get for a 32, 16, 8 and 1 pixel sprites this: # pixels Size 32 16 8 1 $01.00 34 17 9 1 $01.10 36 18 9 1 $01.20 38 19 10 1 $01.30 40 20 10 1 $01.40 The growth is relative to the size. If you stretch a balloon of 1m by 10% or one of 50cm by 10% you get different absolute growths. Same with sprites. So if you want to have two different sizes sprites to have the same angle, you need to have different STRETCH and TILT for each. Edited March 30, 2022 by 42bs Quote Link to comment Share on other sites More sharing options...
42bs Posted March 30, 2022 Share Posted March 30, 2022 stretch $00.10 stretch $00.20 pixel size pixel size 32 $01.00 16 $01.00 34 $01.10 18 $01.20 36 $01.20 20 $01.40 38 $01.30 22 $01.60 40 $01.40 24 $01.80 First gradient is (40-32)/5 = 1.6 Second gradient is (24-16) = 1.6 So both sprites have the same slope. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.