Author Topic: the beginnings... and many questions.  (Read 11355 times)

0 Members and 1 Guest are viewing this topic.

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #20 on: December 18, 2011 »
@Shockwave. np, no hurry at all. I'll still mess around with things some more, etc. Already changed up the code a lil' again, but depending on how these translucency's work I may just have to change them back as I use the (RGBA) alpha channel to fade my rasters atm.

@Hotshot. thanks, its all learning... and the code is messy as, as i was testing things. Once I learn more and understand how things operate, etc I will complete it. Until then, its still learn learn learn. :) btw, how long you had this handle/nickname for? I was known as 'HotShot' back in c64 days. Ran a small group named 'STRIDER', mainly traded, did graphics... tried to learn to code, but was over my head at the time, although I was and still am a big demo scene fan. HotShot, Druid, Tonster. Also use to be involved with 'The Force' aka 'The Atomic Force', 'Sabotage' and a few others. Fun times, just a shame I didn't learn to code in ASM back then.

Thanks for all the help guys.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: the beginnings... and many questions.
« Reply #21 on: December 18, 2011 »
Quote
btw, how long you had this handle/nickname for?

I used be very good at POOL when I potted 7 Balls hence why they called me  "HOTSHOT" at Deaf College when I played them! LOL  ;D


Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: the beginnings... and many questions.
« Reply #22 on: December 19, 2011 »
I just had a look at your example - it's really cool :)

anyway, please see the attached file, I've made an additive blend sub for you;

Code: [Select]
SUB BlendPixel(byval DX as integer, byval DY as integer, byval opacity as double, byval pwrite as integer)
   
    ' ****************************************************************************************
    ' * This could be done better with a predefined function - it's just broken down into    *
    ' * stages here for illustration purposes                                                *
    ' ****************************************************************************************
   
    DIM RDV AS INTEGER
    DIM GDV AS INTEGER
    DIM BDV AS INTEGER
   
    DIM RWV AS INTEGER
    DIM GWV AS INTEGER
    DIM BWV AS INTEGER

    DIM RCV AS INTEGER
    DIM GCV AS INTEGER
    DIM BCV AS INTEGER


    DIM GPX as uinteger
    GPX = BUFFER(DX+(DY*XRES))

    RWV = ((pwrite shr 16) and &H000000FF) * OPACITY
    GWV = ((pwrite shr 8) and &H000000FF)* OPACITY
    BWV = (pwrite  and &H000000FF)* OPACITY
   
    RDV = (GPX shr 16) and &H000000FF
    GDV = (GPX shr 8) and &H000000FF
    BDV =  GPX  and &H000000FF

    RCV = RWV+RDV
    GCV = GWV+GDV
    BCV = BWV+BDV

    IF RCV>255 THEN RCV = 255
    IF GCV>255 THEN GCV = 255
    IF BCV>255 THEN BCV = 255
   
    BUFFER(DX+(DY*XRES)) = RGB(RCV,GCV,BCV)
   
END SUB

It's not the best way of doing it, in fact whenever I do stuff like this I predefine an instruction (you can do this with #DEFINE) and with a bit of bitshifting and anding you can get a fast alpha blend function.

I've made the sub in this way so that you can see how to chop up an rgb value, mess with it and combine it.

Anyway here's how to use it;

Code: [Select]
BLENDPIXEL(SCREEN X , SCREEN Y, OPACITY , RGBCOLOUR )

Opacity should be a number between 0 and 1
0 is totally transparrent, .5 is half transparrent, 1 is fully opaque etc..

It blends the RGBCOLOUR pixel you give it with whatever is at screen x and screen y.

Hope that helps :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #23 on: December 20, 2011 »
@Shockwave. Thanks for that.. now i'll have to sit down and try to work out what you did. Wasn't what i was after tbh, but I can always use that elsewhere. In you binaryfont demo bdf.bas, you have a binary scroller at the bottom which fades from 'grey' to 'dark purple' (i think), thats the kind of effect im looking for for my bitmap scroller, but instead of fading from a colour to a colour, i want to fade from the full 256 colours, to translucent (the actual scroller is translucent the closer it gets to the screen borders). Hard to explain.... I added a png file to show the effect I am after. So basically, anything underneath the scroller would show through when the scroller bitmap itself faded to translucent.

I think I'm getting ahead of myself tho', as I'm having trouble enough understanding some of the code and what does what still. As for that translucent pixel subroutine you did, that would work well for rasterbars.

I also tried to get those copperbars running vertically, but couldn't do it :/ rather than set it out like....

Code: [Select]
FOR LP = 1 TO YRES-1
Buffer ((20+LP*XRES))=&h0a000b00
Buffer ((19+LP*XRES))=&h0a000b00
Buffer ((18+LP*XRES))=&h0a000b00
Buffer ((17+LP*XRES))=&h0a000b11
NEXT

I tried to use the custom copper routine, but to no success... eg.

Code: [Select]
for LP=1 to XRES*YRES
            customcop(LP)=&h0a000b18
            SELECT CASE LP
            CASE 0 TO XRES*10
            customcop(LP)=&h0a000b22
            CASE XRES*10 TO XRES*20
                customcop(LP)=&h0a000b33
            CASE XRES*20 TO XRES*30
                customcop(LP)=&h0a000b44
            END SELECT
NEXT

IDK, gettin rather confused with it all atm, its a bit overwhelming trying to understand it all when I have little idea how things work atm. Appreciate all the help tho', as I'd be well stuck without it.

* attatched is the effect i was looking for.



Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: the beginnings... and many questions.
« Reply #24 on: December 20, 2011 »
Yep, the routine I wrote for you does the effect you posted - It's definitely the effect you wanted, I was hoping to see if youd work out how to use the routine I made to achieve the effect. You need to decrease the capacity of the pixels towards the edges.  My routine has a parameter that you can change from 0 to 1.  Read the post again and look at the routine again carefully.  A hint for you, on the scroll text letter routine you need to work out how far from the edge you are and if you are in the region you want to fade, turn that distance between the pixel you want to plot and the edge into the opacity value.

If you're still stuck let me know and I'll give you another hint.:)

[edit = spelling mistakes caused by mobile phone "predictive text correction" fixed]
« Last Edit: December 20, 2011 by Shockwave »
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #25 on: December 20, 2011 »
hmm, I had that in the back of my mind tbh about that procedure, eg working out 100px from the left border then doing a transition fade from solid to translucent. In the mean time, i did mess around with the function and saw that if I overlay it on the logo's, I can get some sort of 'negative' effect if I switch up the sub routines values... something to mess with later on i guess.

I'll have a play with what you said, see if I am able to do it. It's still a big learning curve for me, so no doubt I will get stuck.

Thanks again.

*edit.... tbch... im frazzled, ive tried to understand what to do where n how n why.. but no luck. :/ like i said, think im getting too far ahead of myself for a newbie coder.
« Last Edit: December 20, 2011 by ttemper »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: the beginnings... and many questions.
« Reply #26 on: December 20, 2011 »
No worries, I'll show you how to use it then :)

Stay tuned.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: the beginnings... and many questions.
« Reply #27 on: December 20, 2011 »
Here you go, I've addressed a lot of the things you've asked about and optimised the code a bit.

No time for any more today I'm afraid as I have presents to wrap :)

Do let me know how you get on though and if you need any more help.

Cheers!

Shockwave ^ Codigos
Challenge Trophies Won:

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #28 on: December 20, 2011 »
Much thanks Shockwave.... you know before my frustrations, I did actually put... blendpixel(SX,SY, 1, MONG) underneath Buffer( XXX + (YYY * XRES) ) = MONG in that sub function for a test, but it threw dots up top of the screen... so I kinda gave up (tiredness and just not being able to think straight doesn't help either). Your code is helping me understand more though which is good.... hell, theres lots to learn... and here I was in DarkBasic throwing things together easy as pie within a couple of days, now FreeBasic is halting me every which way it can. Weird.

As for the coppers, its better to do it the ASM way? cos tbh, I understand the old copper structure, how they are made and put to buffer, but now.... I wouldn't have a clue how they work. ASM isn't my strong side, never could understand it.

As for the effect, very nice, that is indeed how I envisioned it... although one thing... the fade out from opacity 1 doesn't blend very well. its a harsh fade atm. I quickly messed with it to see what did what, and i changed the OPACITY 1 to .8 which then blends from sided to main proper (as I wanted it to), but I'm left with a pink tinge over the whole scroller.... which I didn't want. I guess I'll mess around some more n see if i can extend the fade from 0 to a full 1 and not .8 opacity. Thanks again.

I tend to get frustrated quickly when I learn and can't figure things out... code newbie ftl :/

*EDIT

If I set the code like this....

    IF EDGE<100 THEN
            OPACITY = EDGE/100
    ELSE
            OPACITY = .9999999999999999
    END IF

then it blends much nicer, but the font looks washed out... is there a tradeoff? or can the font be opacity 1 with a nice fade instead of seeing the border where it begins to fade?

*EDIT

changed the bottom raster/coppers to blue fade to back/translucent and the scroller seems to fade out ok with opacity 1 set, so I guess it has alot to do with the bg colour AND the font colours to what blends nice, and what doesn't. Thanks again.
« Last Edit: December 20, 2011 by ttemper »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: the beginnings... and many questions.
« Reply #29 on: December 20, 2011 »
I'm glad it's working a bit better for you :)

About the ASM way of drawing the copper lines, it is definitely among the fastest ways of doing it, not much slower than simply erasing the buffer and even if you don't understand the code it's easy for you to change as all the colour values for each line are in data statements at the bottom of the listing so to change the colours, just change the data :)

As for the blending, it can be difficult to get right, there are lots of different methods of blending, I've just done a very basic blend for you to get started..

You could try different blend methods in that blend sub..

Multiplication Blend:
Code: [Select]
(Colour1 * Colour2) /255

Screen Blend (inverts the colours before multiply blending but should result in a somewhat brighter image):
Code: [Select]
255 - ((255 - Color1)*(255 - Color2))/255

There are loads more different blend techniques, it's just a case of experimenting!

btw, when you use .9999999999999999 as the default opacity, it means that all the scroller pixels are drawn with the blend function, not just the edges which isn't really desirable as it will look washed out and take longer to draw the whole scroll.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #30 on: December 21, 2011 »
hmm, well that worked... must be something in my text causing an error in posting... idk. anyways...

thanks. :)

yeh, i figured by setting the opacity to less than 1 it would then use the blend function for all. i wasn't happy using it all like that, so that's why i changed the raster lines below to blue etc, soon as i did that the scroller fades with opacity 1 set looked a lot cleaner transition from opacity 1 (100px in) to fade out (on the edge border). seeing that the font is more blue orientated i thought it would fit/blend nicer... and it did.

i understand the hex colour codes np, but as for the 'data' lines. how does the script know where to pull the information from for the customcopper?, as i see no reference to 'data' in that proc.

also that asm code, able to explain what is happening to the stack there please. i see tc and slice are an integer, and pp is a pointer for the buffer(x*y), but i have no clue what the asm code does.

slowly understanding things.... and you (and others) are probably thinking 'damn newbie'. :/

*edit, it seems it didn't like the code I placed in here, even though I had it within the [ code ] brackets.

question... i've tried to get scroller1 doing a nice sinewave effect, yet i cant seem to do it... i have no clue as to why, i referred to other source code on here... but no success. :/ help is needed again.. what the hell am i doing wrong? :/
« Last Edit: December 21, 2011 by ttemper »

Offline ttemper

  • Amiga 1200
  • ****
  • Posts: 267
  • Karma: 7
    • View Profile
Re: the beginnings... and many questions.
« Reply #31 on: December 22, 2011 »
ok, after still attempting to create this sinewave... i give up, i don't know what im doing wrong, and i cant find any reference material to read over or learn from... its like trying to find a diamond in a volcano surrounded by alligators... just aint gonna happen.

extremely lost on what im doing wrong. i can make it wave back an forth, and up and down, but as for individual letters doing the whole wave... nup.

please elp! (yeh im that frustrated i lost my letter h)


*EDIT....

Ok.... after some more messing and referring to code on this forum (much much help), I have seemed to now have been able to sinewave my scroll... \o/... frustration got the better of me before, but after trial and error, I know know how to do it. again... \o/. hehe.

I'll be sure to ask more and more questions as time goes on... but I will attempt to code things myself. Your help is always much appreciated.
« Last Edit: December 22, 2011 by ttemper »