Morph 105 - Optimisation

In the Morph 102, i mentioned that i wouldnt optimise. Well, I lied.
The previous chapters processed the colour of each pixel within every polygon. This is something I had to do as textures didnt exist in 1991 (no for me anyway)

Well now, we have gfx standards that deliver the above a lot faster.

Screens are now true colour, rather than 32 indexed colours. The Amiga did have HAM mode which meant my implementation in BlitzBasic was a lot better.

True colour makes all colours accessible, which means we can fade between colours by changing the alpha of the second image and not worry about working out every individual color.










If we draw the first image (as a solid colour) and then change the alpha for the second image from 0 (transparent) to 1 (solid) we will still have the same effect as  processing each pixel using linear interpolation. The benefit is we are drawing the whole image at once and dont have to worry about pixels. t will become our alpha value.

The next optimisation is to use textures for each polygon.
This allows us to wrap a texture onto the points of a polygon and let the computer stretch it. It will distort it for us as the points of the polygon move.

Each point of the polygon will have an xy co-ordinate and a uv co-ordinate within the texture. uv are beween 0 and 1
To find the uv, we can divide the x co-ordinate of the point by the width of the image and the y co-ordinate by the height

When the source polygon xy co-ordinate moves using linear interpolation, the uv co-ordinate will stay the same. This means the source image will distort as it moves to the final destinations.
The opposite will happen with the destination image. It will started distorted and move to the correct positions. As we fade it in (drawing it more solid), the image will look like it morphs.

A final CerberusX example is here

Final Chapter - 106 - https://devdevandmoredev.blogspot.com/2019/08/morph-106-final-thoughts.html

Links to all chapters
Part 1 https://devdevandmoredev.blogspot.com/2019/08/morph-101-intro-to-morphing.html
Part 2 https://devdevandmoredev.blogspot.com/2019/08/morph-102-colour-changing.html
Part 3 https://devdevandmoredev.blogspot.com/2019/08/morph-103-moving-pixels.html
Part 4 https://devdevandmoredev.blogspot.com/2019/08/morph-104-drawing-polygons.html
Part 5 https://devdevandmoredev.blogspot.com/2019/08/morph-105-optimisation.html
Part 6 https://devdevandmoredev.blogspot.com/2019/08/morph-106-final-thoughts.html

Comments



  1. Really, it's a great blog.
    Thank you for sharing useful information with us.
    Morpheus tv apK app is the best application which is suitable for laptops, windows, ios users. You should known the complete details.....

    Morpheus TV For Laptop

    Morpheus TV iOS

    Morpheus TV On Firestick

    ReplyDelete

Post a Comment