• Create Account

Banner advertising on our site currently available from just \$5!

# MrOMGWTF

Member Since 26 Jul 2012
Offline Last Active Oct 26 2014 04:58 AM

### Extracting surface reflectance or lightning intensity from a single image.

19 October 2014 - 06:55 AM

I'm was struggling with this for a while. Simply said, I want to approximate the surface reflectance factor for each pixel from a single image. Let's have a look at this simple equation:

Where:

pi - Pixel intensity

sr - Surface reflectance at the current pixel

n, l - Self explanatory

Now, mathematically, it's not possible to recover sr just by having pi. So the only option here is to somehow statistically approximate it. How can I accomplish that? I mean, our brain does it everyday, so it's definitely possible to approximate it accurately. Does anybody have any ideas?

### Lens blur in frequency space

10 November 2012 - 05:32 AM

Hey

I've read somewhere about fft bokeh (lens) blur. I'm trying to implement it. I'm totally new to fft and stuff.

I managed to successfully fft an image, I have an 2d array of complex numbers.. when I do a backward fft, I get the same image as before, so it works.

How can I filter it to get a bokeh effect?

### C# OpenTK - VBO problem :(

21 October 2012 - 07:58 AM

I've spent like freaking 1 hour trying to fix this problem, nothing worked.. eh..
After implementing my VBO class, I decided to give it a try. But somehow, nothing renders on the screen!
My VBO is a one simple triangle. I have no idea why isn't it working. It's OpenTK.
Here's my code for VBO:
```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK.Graphics.OpenGL;
using OpenTK;
using System.Runtime.InteropServices;

namespace CentipedeRenderer
{
public class VBO
{
public int VertID = -1;
public int IndicesID = -1;
public int VertCount;
public int IndicesCount;

public void Create(List<Vector3> vertices, List<uint> indices)
{
VertCount = vertices.Count;
IndicesCount = indices.Count;
Free();
GL.GenBuffers(1, out VertID);
GL.GenBuffers(1, out IndicesID);
//pass the indices
GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndicesID);
GL.BufferData<uint>(BufferTarget.ElementArrayBuffer,
(IntPtr)(indices.Count * sizeof(uint)),
indices.ToArray(),
BufferUsageHint.StaticDraw
);

//pass the vertices
GL.BindBuffer(BufferTarget.ArrayBuffer, VertID);
GL.BufferData<Vector3>(BufferTarget.ArrayBuffer,
(IntPtr)(vertices.Count * Vector3.SizeInBytes),
vertices.ToArray(),
BufferUsageHint.StaticDraw
);
}

public void Draw()
{
GL.EnableClientState(ArrayCap.VertexArray);
GL.BindBuffer(BufferTarget.ArrayBuffer, VertID);
GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes, 0);

GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndicesID);

GL.DrawElements(BeginMode.Triangles, 3, DrawElementsType.UnsignedInt, 0);
}

public void Free()
{
GL.DeleteBuffers(2, new int[] { VertID, IndicesID } );
}
}
}
```

And code where I test the VBO:
```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK;
using OpenTK.Graphics.OpenGL;

namespace CentipedeRenderer
{
public class Renderer
{
public static Renderer GRen; // Global RENderer
public Scene Scene;

VBO testvbo;

public Renderer()
{
GL.Enable(EnableCap.DepthTest);
Matrix4 proj = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (1280.0f / 720.0f), 1.0f, 100.0f);
GL.MatrixMode(MatrixMode.Modelview);
testvbo = new VBO();
List<Vector3> verts = new List<Vector3>();
List<uint> indies = new List<uint>();

testvbo.Create(verts, indies);
}

public void Render()
{
testvbo.Draw();
}
}
}
```

The syntax is similar to OpenGL's one, so even if you don't know OpenTK, I think you could help me

Thanks

@edit
OH MYYYY GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOD
FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

@edit2:
GUESS WHAT
I FIXED THAT
.
.
.
AND IT STILL DOESN'T WORK ;_;

### OpenGL Framework/Helper library

20 October 2012 - 07:02 AM

Hey, do you know any free to use OpenGL libraries that provide this kind of framework:
- FBO class
- VBO class
- Texture class
- etc.

You know what I'm talking about?
D3D has much more features than OpenGL... I don't really have time to write this kind of framework myself.

### Creating instance of the class, as a pointer or not?

20 October 2012 - 02:18 AM

Hey, I wasn't coding in C++ for A LOT of time, I was coding in C#.
Today I decided to switch back to C++.

I don't know what to do:
There is a global variable, renderer. It's declared as extern in a header file, so I can use it from other files.
And now, should I declare it like this? :
```.h
extern Renderer* renderer;
.cpp
renderer = new Renderer;
```
Or like this:
```.h
extern Renderer renderer;
.cpp
renderer = Renderer();
```

Maybe it's a stupid question but it's a dilemma for me :s
Which option is better?

PARTNERS