Author Topic: pixel shader mandelbrot  (Read 2785 times)

0 Members and 1 Guest are viewing this topic.

Offline efecto

  • C= 64
  • **
  • Posts: 90
  • Karma: 4
    • View Profile
pixel shader mandelbrot
« on: September 07, 2009 »
I'm trying to render a mandelbrot in a pixel shader.

I use one of iq's 4k frameworks and have converted his g4k_OGLShader example from GLSL to HLSL

However only a part of the mandelbrot is showing. (as seen in the attachment)
I don't think it is the hlsl code as that is pretty much the same as the glsl

so i think it is in the texture coordinates or the vertex setup, but that seems okay.
Anyone an idea where i should start looking?

cheers,
Efecto

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: pixel shader mandelbrot
« Reply #1 on: September 07, 2009 »
If you want the full set, you need the coordinates -2,-2 to +2,+2.  I would guess the incoming pixel fragments have screen x, screen y as the inputs, so you'd need to do
inputx = (x-(screenwidth/2)/(screenwidth/4)
inputy = (y-(screenheight/2)/(screenheight/4)
and plug those inputs into the mandelbrot equations.

Jim
Challenge Trophies Won:

Offline efecto

  • C= 64
  • **
  • Posts: 90
  • Karma: 4
    • View Profile
Re: pixel shader mandelbrot
« Reply #2 on: September 08, 2009 »
Ah..
I was using texture coordinates, so only range 0-1.

worked around than now (as i don't have a vertex shader).
mandelbrot is working now.

Thanks Jim !