/korender

3D graphics engine for Kotlin Multi-Platform

Primary LanguageKotlinApache License 2.0Apache-2.0

Korender korender

Maven Central Kotlin android windows linux

Kotlin Multiplatform 3D graphics rendering engine based on OpenGL / OpenGL ES.

Korender uses declarative approach that seamlessly integrates 3D viewport into Compose Multiplatform UI. Same Korender code runs on all supported platforms.

@Composable
fun App() = Korender {
  Frame {
    Camera(DefaultCamera(Vec3(0f, 5f, 30f), -1.z, 1.y))
    Pass {
      Sky(sky(FastCloud))
      Renderable(standart(FixedColor) { color = Green }, mesh = sphere(2f), transform = translate(-0.5f.y))
    }
    Pass {
      Screen(effect(Water), sky(FastCloud))
      Billboard(effect(Fire) { yscale = 10f; xscale = 2f }, position = 6.y, transparent = true)
      Gui {
        Filler()
        Text(text = "FPS ${frameInfo.avgFps}", height = 50,  color = Red, font = "/ubuntu.ttf", id = "fps")
      }
    }
  }
}

Korender

Korender is BETA - any APIs may change without notice.

Supported platforms

  • Desktop (Windows/Linux) - based on LWJGL
  • Android - based on OpenGL ES API

Features

  • Rendering opaque and transparent objects
  • Diffuse, specular and ambient lighting (directional light)
  • Projection shadow maps with percentage close soft shadows
  • Texturing:
    • uv mapped
    • triplanar
    • detail
  • Bump mapping
  • Predefined and custom meshes
  • Wavefront .obj model file loading
  • Billboards (sprites)
  • Batching (instancing)
  • Simple heightfield (terrain)
  • Textured or shader sky
  • On-screen basic GUI
  • Custom shaders support
  • Multi-pass rendering and screen-space shaders (filters)
  • Simple effects
    • smoke
    • fire
    • water

Quick start

or, create an application from scratch:

  • Generate a new KMP application using Kotlin Multiplatform Wizard. Select Android and Desktop platforms.
  • Add Korender dependency com.github.zakgof:korender:0.2.0
  • Add the above code to commonMain
  • Run on desktop: .\gradlew composeApp:run

Examples showcase app

Examples source code

Further reading

Explore the Korender Wiki