Giter Site home page Giter Site logo

meta4d-me / catdogengine Goto Github PK

View Code? Open in Web Editor NEW
156.0 156.0 15.0 623.07 MB

A cross-platform game engine/editor written in modern C++ (WIP)

License: GNU General Public License v2.0

Batchfile 0.21% Shell 6.99% C 6.66% C++ 82.94% Lua 1.26% SuperCollider 0.95% Scala 0.97% Java 0.03%
3d bgfx ecs editor game-engine graphics-engine imgui premake sdl

catdogengine's People

Contributors

bxy176179 avatar chaosxdemon avatar hinageshi01 avatar lincac avatar ovoaovo avatar ssamjoel avatar t-rvw avatar vtui22 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

catdogengine's Issues

[Terrain] Create Terrain Rendering Path

Currently we do not have a way to render terrain other than a demo one. This task captures all the effort to bring Terrain related rendering to this engine.

[PBR-Sky] Rendering atmospheric light scattering

Light scattering is the basic thing to describe the color of the sky.

[Editor] Create project file

A project should have a config file about:

  • Working directory
  • Project settings
  • Serialization files about the whole world
    • SceneDatabase : done
    • Entities and Components : TBD

[Android] Modify makefile to build and test if it runs well

Based on my experience,

  • make a build is OK as codes are almost 99% cross platform.
  • shader may run differently.
  • some features may not support in low end device, such as mrt.

If you are not familiar with CatDogEngine, build bgfx + sdl in android maybe easier for you to learn.

Codes/Performance/Memory Improvement

To improve coding details:

  • define FORCEINLINE macro explicitly to force some methods to compile as inline.
  • force all string hash to be executed in the compile time.
    • Only init logics will use runtime hash now.
  • std::move -> MoveTemp similar to UE so that we can get static_assert if the parameter is a const or already rvalue.
    • Engine side needs to replace. But it will include many header files?

To adopt modern cpp features:

  • C++ 20 std::span helps to reduce code size

To add basic infrastructure:

  • add allocator classes to improve memory layout.
    • std::unique_ptr needs to write a customized deleter class for it to free memory by ourselves
  • JobSystem to support multiple threads
  • SIMD Math

[FrameGraph] Improve high level rendering usages

1.A resource manager holds every resource handles in bgfx. Any renderers can use string to find the expected one.
2.As RenderGraph talk said, I need to split resource compile stage away from render logic!

[Editor] Inspector

  • Draw UI for different components
    • Camera/Light now
    • Property Data
      • [Min, Max]
      • Update intermediately after changes.
      • User friendly. For example, use angles to present quaternion for Transform::Rotation.
      • Accesses for ReadOnly / ReadWrite.

[shaderc] error: initial value must be a literal expression

When compiling as hlsl, variables cannot be initialized outside the function with expressions that contain other variables.
For example:
float test = 0.5 is ok to compile in every case, but float test2 = test * test will cause an compile error in hlsl case.
I haven't tested all cases, but float test2 = test * test is ok to compile in glsl, spirv and pssl case.
What's worse is that even write float test = 0.5 and compile it to hlsl, the value of test is actually 0.

[Editor] Features overview

TODO:

  • Settings
    • read/write/apply localization settings
    • keyboard hot key settings
    • editor user settings
  • Styles
    • splash
    • dpi aware GUI to fit 2K, 4K, ...
    • multiple viewports
  • Scene Edit
    • camera control in the scene view
    • select and pick mesh in the scene view
    • switch wireframe/shading without texture/shading with texture
  • Rendering
    • optimize drawcalls -> one drawcall UI

[Visual Studio] Natvis

I remember there is a way to describe what should show in the watch list. Forget its name...

[ECS] manage registered entites

How to manage them effeciently? If you just store all entites in the array, then you need to loop through its components by n * O(1) hashmap query to decide how it looks like?
Entt has a class Registry design which we can have a look.

[Terrain] Sectorized train generation and rendering

Description

Current we only have one large terrain that's generated with the following parameters:

  • Number of rectangles in the X-axis
  • Number of rectangles in the Y-axis
  • Width of each rectangle
  • Depth of each rectangle
  • Max depth for the entire terrain
  • Up to 6 frequency parameters and their seeds for the Simplex2D function

With these parameters, we will generate a single mesh composed of many triangles with varying heights samples from Simplex2D noise function. This issue focuses on breaking these up into individual mesh with no seams in between. These sectors will only be sent to render if it's within the range of the viewing frustum.

Success Criteria

  • Terrain generation is able to specify the dimension and the number of sectors.
  • Each sector will retain the same number of parameters as the initial description.
  • The TerrainRenderer will only send near-by meshes to render. Specifically it should be the ones intersecting with the view frustum.

[Terrain] Support CLOD Terrain

Description

Given the generated terrain meshes with their LOD, we need to support the picking of the right LOD at render time.

Success Criteria

  • Terrain meshes have their LODs swapped in when they are far and swapped in when they are near.

[Editor] ImGui multiple viewports

In general, it is a two direction conversion feature about ImGuiWindow <-> Window.

  • ImGuiWindow
    • No hwnd. Just rendered quads.
    • No standalone SwapChain/RenderTarget. Shared by all ImGuiWindows.
    • Hard to process input preciously. SceneView logic is a mass.
  • Window
    • Sure has hwnd.
    • Sure has standalone SwapChain/RenderTarget
    • Input logic is easy to handle. But take care focus/device get/lose cases.

[shaderc] variable in fragment shader seems optimized but actually used in bgfx shader language

fs_SingleScattering_RayMarching.sc
void main()
{
	vec3 rayStart = u_cameraPos;
	vec3 rayDir = normalize(v_worldPos.xyz);

        // lightDir was optimized here
	vec3 lightDir = normalize(-u_LightDir);
	
	// We assume that camera always in atmosphere.
	vec2 atmIntersection = RaySphereIntersection(rayStart, rayDir, _PlanetCenter, _PlanetRadius + _AtmosphereHeight);
	float rayLength = atmIntersection.y;

        // It is ok to put here
	// vec3 lightDir = normalize(-u_LightDir);

	// If ray intersect whith the earth.
	vec2 earthIntersection = RaySphereIntersection(rayStart, rayDir, _PlanetCenter, _PlanetRadius);
	if (earthIntersection.x > 0.0) {
		rayLength = earthIntersection.x;
	}
	
	vec3 inscattering = IntegrateInscattering(rayStart, rayDir, rayLength, lightDir);
	
	vec3 color = PostProcssing(inscattering, 0.0);
	gl_FragColor = vec4(color.x, color.y, color.z, 1.0);
}

[Editor] Basic scene edit

  • ImGuizmo operations on entites
  • Better visual controls
    • Wireframe
    • White color models
    • Switch IBL/PBR sky
  • More entites to place in the scene
    • Light
    • Camera
    • ...

[Material System]

  • Material template for all material types
    • default values
    Material CreateMaterial() {
        Material material;
        material.albedo = vec3(0.99, 0.98, 0.95);
        material.normal = vec3(0.0, 1.0, 0.0);
        material.occlusion = 1.0;
        material.roughness = 0.8;
        material.metallic = 0.2;
        material.F0 = vec3(0.192, 0.192, 0.192);
        material.opacity = 1.0;
        material.emissive = vec3(0.0, 0.0, 0.0);
        return material;
    }
    
  • CatDogEngine PBR
    • Apply CDPBR's rules to Material template.
      • override values when material instance changes its config
        • BaseColor file path applied -> material.baseColor = SampleAlbedoTexture(...)
        • NormalMap file path applied -> material.normal = SampleNormalTexture(...)
        • it uses ORM -> support two cases
          • AO + RM
            • material.ao = SampleORMTexture(...).r
            • material.roughness = SampleORMTexture(...).g
            • material.metallic = SampleORMTexture(...).b
          • RM
            • material.roughness = SampleORMTexture(...).g
            • material.metallic = SampleORMTexture(...).b

[Make a Game project]

For a game engine, the best testing about performances and features is to make a game.

[Editor] FileSystem for AssetBrowser

  • Show folder tree in the UI window
  • Show images in the UI window
    • (Optional)Image in disk -> CPU memory -> bgfx::createTexture -> bgfx::TextureHandle -> uint16_t -> ImTextureID -> ImGui::Image
    • Model
      • Need to setup a simple Renderer to draw RTV and save as texture handle.
    • Texture
      • .tga / .png -> bgfx texturec -> .dds
      • .dds -> bgfx::createTexture -> bgfx::TextureHandle -> ...
    • Material
      • Need to setup a simple Renderer and setup a sphere/... to attach textures and save as texture handle.
    • ...

[RHI] New RHI except bgfx.

We want to avoid using bgfx as the only one RHI for this game engine. As bgfx is a compatiable RHI, not an advanced one.
So it has some works to remove dependencies from bgfx. And consider to use new RHI with same shaders from bgfx. Also, we are happy to try to reuse some codes in the rendering logic side.

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.