News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] haze and water in a room?

Started by Munchy, February 11, 2019, 12:13:06 AM

Previous topic - Next topic

Munchy

I've delved into the tricky topic of custom layer 3 stuff in the past and - while I have the horrible feeling that the answer to my question is basically "no"/"yes but with weird implications" - would it be possible to make a room feature both a haze (in this case I'd like to move it into the background to create the illusion of more depth in a cave) and water?

Munchy

Gah, sorry, should have been in `engine works`.  I'm tired! apologies!

benox50

Yea its possible and its great. Because HDMA doesnt count as a layer
However I never got it to work with negative layer 3 for the moment, only positive color math.
This helped me alot https://www.smwcentral.net/?p=viewthread&t=27054

Smiley

You can simply run JSL $88DDC7 once via eg. room setup ASM to spawn vanilla haze. How it interacts with water depends on the other FX settings and some settings are pretty interesting.

For more customized haze, use this:

lorom

org $88EE40

  JSL $888435    ;Set up HDMA
  DB $00,$32    ;Direct 1 register write once, Fixed color data
  DW #Inst    ;Pointer to instructions
  RTL

Inst:
    DW $8655 : DB $88  ;Source is this bank
    DW $866A : DB $88  ;Table is in this bank
Loop:
    DW #$4000 : DW ColorTable ;Displays color table for $4000 frames (high value reduces lag ever so slightly)
    DW $85EC : DW #Loop       ;Loops back

;Format for color table:
;[Scanline count] [Color]
;Scanline count is how many rows to display the following color for
;Format for color is
;  bgrccccc
;  b/g/r = Which color plane(s) to set the intensity for.
;  ccccc = Color intensity

ColorTable:
  db $1f,$00    ;HUD part, no color here
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$41
  db $10,$43
  db $10,$45
  db $10,$47
  db $10,$49
  db $10,$4B
  db $10,$4D
  db $10,$4F
  db $00

All you need is JSL $88EE40 to run that and you'll get custom haze, which you can easily modify by tweaking ColorTable. You might also need to tweak some color math related registers to get the effect you want.

Munchy

Quote from: SMILEuser96 on February 11, 2019, 01:11:09 AM
You can simply run JSL $88DDC7 once via eg. room setup ASM to spawn vanilla haze. How it interacts with water depends on the other FX settings and some settings are pretty interesting.

For more customized haze, use this:

lorom

org $88EE40

  JSL $888435    ;Set up HDMA
  DB $00,$32    ;Direct 1 register write once, Fixed color data
  DW #Inst    ;Pointer to instructions
  RTL

Inst:
    DW $8655 : DB $88  ;Source is this bank
    DW $866A : DB $88  ;Table is in this bank
Loop:
    DW #$4000 : DW ColorTable ;Displays color table for $4000 frames (high value reduces lag ever so slightly)
    DW $85EC : DW #Loop       ;Loops back

;Format for color table:
;[Scanline count] [Color]
;Scanline count is how many rows to display the following color for
;Format for color is
;  bgrccccc
;  b/g/r = Which color plane(s) to set the intensity for.
;  ccccc = Color intensity

ColorTable:
  db $1f,$00    ;HUD part, no color here
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$00
  db $10,$41
  db $10,$43
  db $10,$45
  db $10,$47
  db $10,$49
  db $10,$4B
  db $10,$4D
  db $10,$4F
  db $00

All you need is JSL $88EE40 to run that and you'll get custom haze, which you can easily modify by tweaking ColorTable. You might also need to tweak some color math related registers to get the effect you want.

AMAZING! Thanks!