Giter Club home page Giter Club logo

3denginecpp's People

Contributors

bennyqbd avatar mxaddict avatar pseudosoftware avatar spaarmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3denginecpp's Issues

Light shaders render stuff after zFar plane

Set your zFar plane from 1000.0 to 50.0 ... you can see that ambient gets culled off, but lights render remaining geometry as "transparent" --- it's same issue when you apply projection matrix which is not right-handed but left-handed...

Does anyone please know how to solve this issue?

Windows model loading bug

The current version of the engine gives the error message
"Unhandled exception at 0x00099C63 in 3DEngineCpp.exe: 0xC0000005: Access violation reading location 0x0000000C.".
Its in mesh.cpp line 248 (const aiMesh* model = scene->mMeshes[0];)The error occurs while trying to load terrain2.obj (error appears only on windows) propably because outdated assimp :) (sorry for bad english im from Czech Republic )

//EDIT: closed, because i just removed by mistake my RES folder :D (stupid me)

Explicit version number 120 not supported by GL3 forward compatible context

Hi, it's me again with the same problem as on OSX. On M$ Windows 8.1 (MSVC 2013 Ultimate) I wasn't able to compile the program, just because those added lines, so I suggest to wrap it around like this

#ifdef __APPLE__ && ifdef __MACH__
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
 #endif

in window.cpp around line 25 and it should work out of the box

Smooth shading / vertex normals

Hi, I'd like to ask how to implement vertex normals into this engine properly. No matter what I do, I either get broken or face normals as the result.

So I'd like to know if someone had a success implementing vertex normals in here.

The reason for smooth shading is my terrain generated from heightmap. My terrain feels blocky due to flat normals. See: http://prntscr.com/9xqiqb

Plane IntersectSphere

It's seems to me that you have error when adding m_distance when determing if plane IntersectSphere.

With simple example plane1(Vector3f(0.0f, 1.0f, 0.0f), 3.0f); and sphere2(Vector3f(0.0f, 3.0f, 0.0f), 1.0f); you will get not intersecting and distance 5, but plane in the middle of sphere.(like in Image)
shereintersecting

Maybe I don't understand, how you define plane, or dot product of vector3.

Can you help me with this?

skeletal animation

your project is awsome,but what about any plan to add model animation feature on your engine? I think it would be very nice.

Calculating shadow map coordinates from model space or world space position.

I've just noticed in the shadow mapping code, the shadow map coordinates are generated by multiplying the lightMatrix with the model-space position of the vertex.

Considering that the light matrix only contains the 'view' and 'projection' parts, don't we need to do lightMatrix * vec4(worldSpacePosition, 1.0) rather than lightMatrix * vec4(modelSpacePosition, 1.0).

Or does your rendering engine include the model matrix in the lightMatrix somewhere.

This is a weird issue because it seems fine with your game, but with my own game engine (with the shadow mapping code inspired by yours) I need to use the worldSpacePosition for it to work correctly.

Bad context creation on apple macs (at least for me)

Hello, I found out, that in Mavericks you should extend the window.cpp with these lines to around 26th line:

SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );

this should fix the problems maybe, for me, it was resolved after this, hence the stock SDL context created was for glsl 1.20...here is the error log if I remove those lines

Supported GLSL version is 1.20.
Error compiling shader type 2: 'ERROR: 0:1: '' :  version '330' is not supported
ERROR: 0:2: 'layout' : syntax error syntax error

Program ended with exit code: 1

lights have a sharp edge

Pointlight casting light on a spherical object, leaves a very sharp edge at the projection edge. Clearly I am throwing around words that I don't understand so here have a picture:
bug
See the sharp edge from the orange light behind the object? Maybe one could solve this with something similar to what you did with the shadows.

And a very similar thing happens with the selfshadow(Don't know if this word exists in English but I mean the shadow produced on the own geometry)
bug2

Oh and please add this to freeMove.cpp:

if (input.GetKey(m_upKey))
    Move(GetTransform()->GetRot()->GetUp(), movAmt);
if (input.GetKey(m_downKey))
    Move(GetTransform()->GetRot()->GetDown(), movAmt);

it makes life easier xD

Linux build [Ubuntu/Arch] Segfault

Hi, just wanna ask if someone had difficulties running the engine.

It seems to crash on MappedValues::SetTexture method.

Engine crashes to terminal.

Organization

Hi, Benny. I really like your series and I am really interested to see a 3D physics engine being implemented. However, the number of classes is getting too much for one folder. Maybe splitting it up into seperate folders for rendering, profiling, etc. (Sorry, I have only known C++ for a few weeks) This is just a suggestion.

Render to texture not working

Visual Studio is not capable of compiling your project anymore. This is, because you used GLenum drawBuffers[m_numTextures]; and Visual Studio doesn't want you to create dynamic arrays this way. The easy fix GLenum* drawBuffers = new GLenum[m_numTextures]; does not work either (but at least it compiles). It gives you this:
effect
effect2

FXAA Problem on Windows

The current version of the engine gives the error message "Error linking shader program: Fragment shader writes to more than 1 type of output gl_FragData, gl_FragColor or user bound frag data.". The error occurs while compiling filter-fxaa.fs.

Shadow Disapearing

Shadow banding appears to be fixed but I still have this issue even with the most recent code. If you pan back while viewing the scene, the shadows begin to disappear. You can see the artifact line moving across where the shadows get removed although it is not visible in the images. I'm working on Windows, VS2013 and have a GTX770.

capture1
capture2
capture3

Weird issue

Some weird issue occurs when I run this. I have followed the build instructions and when I run, all I see is a black screen.

When I back up a little bit(S key) I see this
image
And when I back up even more, this shows up
image

I'm on Windows 7 (32 bit), using Visual Studio Express 2013
OpenGL version (according to graphics card) is 6.14.10.12874

It's me...again...

Hello, I've recently tried to build the modified code you made when I proposed you to put preprocessor macro to the version setting in window.cpp...it works flawless with Windows 8.1 and MSVC 12 (2013) but it throws me error for OpenGL context as far as I don't remove or comment out those lines of setting up GL version via SDL...I'm truly sorry to bug you around with this crap, but on the other side, it should be cured in some way

Support for Multi-Mesh OBJ files

I was recently looking at importing the sponza model into the engine but found it wouldnt load correctly due to the lack of support for multiple meshes in obj files.

Black screen issues

Im having issues with all builds after the implementation of the profiling. From what i can tell nothing is rendered on the screen i have tried looking around and moving
black screen

my computer specs are:

AMD A4-5000 APU
8GB RAM
AMD Radeon HD 8330 & 8500M

i have tried the AMD 14.4 and 14.6 Drives

Plane normalization

Hello,

From my point of view plane normalization contains a bug

Plane is defined with normal and distance.
That means, we should find some plane point just by multiplication:

P = N * D

if plane was defined like:
plane1(Vector3f(0.0f, 2.0f, 0.0f), 3.0f);
means, that P = (0, 6, 0)

after plane normalization with current implementation we will have:
plane1Norm (Vec3(0, 1, 0), 1.5);

as a result P1 = Vec3(0, 1, 0) * 1.5 = (0, 1.5, 0)
instead of (0, 6, 0)

I think in normalized method distance should be multiplied by magnitude instead of division.

Plane Plane::Normalized() const
{
	float magnitude = m_normal.Length();

	//Dividing the normal by it's length performs vector normalization.
	//Distance however, must also be divided by the normal's length in
	//order to create an equivalent plane.
-	return Plane(m_normal/magnitude, m_distance/magnitude);
+	return Plane(m_normal/magnitude, m_distance*magnitude);
}

Variance Shadow Mapping - Breaks rendering

The latest commit which implements variance shadow mapping appears to have broken the functionality as it existed pre-shadows.

The first soft shadowing code worked perfectly but the variance shadow mapping code appears to break all the lighting, normal mapping etc although there are basic textures rendered.

This was run using unmodified latest checking from the repository. Maybe another nVidia/Intel/ATI issue?

broken

Variance Shadow Mapping texture problem

Hi Benny, I'm porting your 3DEngine to Java and accidentally bump into issue with texture creation.
In you Variance Shadow Mapping Implementation video you changed shadowMap internal format to GL_RG32F and since then is my rendering broken. The PCF shadow smoothing work just fine, but this is not.

github-shadows-after

The issue started here, after changing this line:

setTexture("shadowMap", new Texture(1024, 1024, null, GL_TEXTURE_2D, GL_NEAREST, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, true, GL_DEPTH_ATTACHMENT));

to line:

setTexture("shadowMap", new Texture(1024, 1024, null, GL_TEXTURE_2D, GL_LINEAR, GL_RG32F, GL_RGBA, true, GL_COLOR_ATTACHMENT0));

Here is my commit of changing code back to PCF shadows:
deamont66/3DEngine@82d9a5a

My code is complete mirror of this commit: https://github.com/BennyQBD/3DEngineCpp/tree/001bc572e85e090df77cd9de2f3cfa61ab3b563a

I don't really know what the issue can be. I have laptop with Intel Integrated Graphic (3.1.0 - Build 9.17.10.3347) and NVidia m555 (4.4.0) on both same result.

P.S.: My code include the fix for depth textures on Intel (glReadBuffer), but changing or removing it doesn't make any effect at all. And sorry for my bad English but it's not my native language.

I will be glad for any help, Thanks.

Runtime failure

Hello, Benny.
I really liked your Intro to modern OpenGL tutorial and decided to try your Game Engine in C++. It compiled fine (I use Visual Studio 2012 and all dependences are resolved with versions of libraries from your repository). But during the runtime at some point assertion failes (see screenshot, I output names of the uniforms before the assertion check to see when it failes). Can it be that name of the uniform is too long or something else specific to my case? If I comment the assertion check it runs but without any lighting.
assert_failure
Thanks in advance.

Too high window sync time

Hey Benny,
I got a issue with my window sync time. I profile SDLSwapBuffers which calls SDL_GL_SwapWindow(window) and it needs a lot of time. On our Forward-Renderer needs it nearly the same amount of time to sync as to render, at the moment about 32ms. On my Deferred-Renderer is the render time nearly 3ms but the sync time about 60 ms. Do you have any idea whats going on?

Thanks in advance and sorry for my bad english.

Normalmapping shadowing in the wrong direction

I know you talked about that in your Video[*] and maybe you alredy fixed this but i just want to catch your attention in case you overlooked this.
3dnormal

as one can cleary see, the light is coming from the yellow direction. the shadowed part (green) should be lit by the light and the highlights (red) should be exactly on the other side of the brick.

[*] http://youtu.be/dF5rOveGOJc?t=24m20s

VSM issue

Hi,
I'm having a very annoying problem...
Every time I change the shadowMap texture (from GL_DEPTH_COMPONENT16 to GL_RG32F) and try to apply the VSM, it messes up the rendering.

I saw the previous issue, it was the same as mine, but instead I have an intel processor...
broken

Also, I'm using Java...

free(): invalid pointer:

hi!
I've compiled the project in linux mint for codeblocks, but I get a pointer error. In "stb_image.c" the free() funcions is giving an error. what can i do?
thanks have a good day.

Change 3DEngineCpp to 3DEngineC

The vast majority of the code in this project is C, and it is confusing to anybody searching for C projects when they come across this with Cpp in the name. Just a recommendation.

missing some files

I was googling for something and found your repo. It looks interested for me, I downloaded it, but building gives errors !
I'm using vs2013 :

Error 4 error C1083: Cannot open source file: 'basicShader.cpp': No such file or directory
Error 1 error C1083: Cannot open source file: 'phongShader.cpp': No such file or directory

just letting you know :)
In case you committed the project correctly, I might consider make the mac build/xcodeProject for you as a support. may be some one out there need it !

cheers;

Fix to free(): invalid pointer: #45

Fixes to prevent Policy warnings from syntax errors in CMake code files.

  1. File: ./cmake/FindGLEW.cmake
    insert: SET(PROGRAMFILESX86 "PROGRAMFILES(X86)")
    before: SET( GLEW_SEARCH_PATHS
    and
    change: "$ENV{PROGRAMFILES(X86)}/GLEW"   # WINDOWS
        to: "$ENV{${PROGRAMFILESX86}}/GLEW"     # WINDOWS
  1. File: ./cmake/FindSDL2.cmake
    insert: SET(PROGRAMFILESX86 "PROGRAMFILES(X86)")
    before: SET( SDL2_SEARCH_PATHS
    and
    change: "$ENV{PROGRAMFILES(X86)}/SDL2"     # WINDOWS
        to: "$ENV{${PROGRAMFILESX86}}/SDL2"   # WINDOWS
  1. File: ./cmake/FindASSIMP.cmake
    insert: SET(PROGRAMFILESX86 "PROGRAMFILES(X86)")
    before: SET( ASSIMP_SEARCH_PATHS
    and
    change: "$ENV{PROGRAMFILES(X86)}/ASSIMP"	# WINDOWS
        to: "$ENV{${PROGRAMFILESX86}}/ASSIMP"	# WINDOWS

Fixes to prevent program execution abort on free(): invalid pointer.

  1. File: ./src/rendering/texture.h, line 60
    from: void operator=(Texture texture);
      to: Texture& operator=(Texture other) noexcept;
  1. File: ./src/rendering/texture.cpp, lines 207-213

    replace:

    void Texture::operator=(Texture texture)
    {
        char* temp[sizeof(Texture)/sizeof(char)];
        memcpy(temp, this, sizeof(Texture));
	memcpy(this, &texture, sizeof(Texture));
        memcpy(&texture, temp, sizeof(Texture));
    }
  with:
    Texture& Texture::operator=(Texture other) noexcept
    {
        //Implemented using move assignment.
    
        //Guard self assignment
        if (this == &other)
            return *this;
    
        if(m_textureData && m_textureData->RemoveReference())
	{
            if(m_fileName.length() > 0)
                s_resourceMap.erase(m_fileName);
	    
	        delete m_textureData;
	}
	m_fileName = other.m_fileName;
        m_textureData = other.m_textureData;
        m_textureData->AddReference();
        return *this;
    }

Originally posted by @gedeschaines in #45 (comment)

Light & Paralax Mapping glitches

Hi, today i encountered some glitches with the rendering of the Light in combination with the Paralax Mapping. Right now i am trying to find a commit where this is not occurring, i wonder if this is a new glitch or i simply did no recognized this. Maybe it hast something to do with a new graphics driver .. i really wonder why i did not recognized this in earlier commits ...

https://www.youtube.com/watch?v=jJeSTRz-mU8

archlinux 3.14.5-1
nvidia 337.25 xorg 1.15
GTX 750 Ti

Deferred Rendering

The current forward rendering technique is easy to learn and good to understand, but a deferred render pipeline would improve performance immense.
I'm working currently on a deferred renderer, but I got some troubles.
Benny, will you implement a deferred renderer sometimes?

Framebuffer with stencil

Creating a texture render target with a stencil attachment gives me GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error. To create the texture target I use these parameters:

  • attachment: GL_DEPTH_STENCIL_ATTACHMENT
  • internal format: GL_DEPTH32F_STENCIL8
  • format: GL_DEPTH_STENCIL
  • data type: GL_FLOAT

Any idea why?

Mesh load failed!

Hi Benny,
Thank you for your great tutorials, but I am having a issue with Mesh load failed as shown below. Do you have any idea why its happen?
screen shot 2015-01-21 at 14 44 40

I am using mac OS(Yosemite), Xcode6.1.1 and have installed SDL2, glew, assimp with brew and cmaked as you described.
screen shot 2015-01-21 at 14 49 33
The models haven't been moved from the res folder.

Thank you in advance,
ochos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.