Skip to content

NAP 0.7.0

Compare
Choose a tag to compare
@cklosters cklosters released this 30 May 12:20
· 243 commits to main since this release

Major release that introduces new features, general improvements and the usual set of fixes.

nap_interface

Download

New Features

Advanced Rendering Operations

NAP 0.7+ introduces a new render module: the naprenderadvanced module. With a set of tools that expand (supplement) the default renderer, including: lights, shadows, cube maps, various new shaders and several rendering-related utilities. The nap::RenderAdvancedService creates and manages internal resources such as render targets and textures that are bound to materials that use these advanced features.

Lights & Shadows

The naprenderadvanced module includes a light system that can be used to create consistent lighting setups using: spot, point and directional lights. Every light is derived from a nap::LightComponent and can cast shadows using shadow maps. On initialization, each light component sets up its own light uniform data and registers itself with the render advanced` service.

Check out the lightsandshadow demo for a complete demonstration of the light system:

lightsandshadow.mp4

You can utilize the standard nap::BlinnPhongColorShader to efficiently render a lit object. Alternatively, you can create a custom shader compatible with the lighting system. For instructions on setting this up, refer to the "Custom Lights" section in the documentation. Material settings can be configured in Napkin using the new shader inspection model introduced in version 0.6.5. For the BlinnPhong shader, these settings include ambient, diffuse, reflection, and specular parameters.

Cube Maps

nap::CubeMapFromFile takes an equirectangular image as input and turns it into a cube map which can be used to - for example - render a sky box using the nap::SkyBoxShader or add environmental reflections to objects using the nap::BlinnPhongShader, which has an environment map and reflection input for this purpose.

Check out the skybox demo to see how to work with cube maps:

skybox.mp4

Render Layers

Render layers allow you to group render components and set the sequence in which they are rendered. These layers are organized and prioritized in a nap::RenderChain where a layer's position in the list specifies its rank: 0 is the frontmost position (rendered first), and the last index is the rearmost. Components without an assigned layer automatically default to the front (index 0).

One useful approach for layers is to render a skybox or another background-filling object first, regardless of its position in the world. To achieve this, add a layer to the render chain named Background (rank 0) and assign it to the component responsible for rendering the background. Then, assign all other objects in the scene to the subsequent layer called Scene (rank 1). This setup ensures that the background is rendered before any other objects in your scene. Note that all objects in a layer are still sorted based on the assigned blend mode.

Render Tags

Render tags can be used to categorize render components. They are not ordered (unlike render layers) and multiple of them can be assigned to a render component. Each tag registers itself in the render service and receives a unique bitmask on initialization, allowing tags to be composited together into render masks.

One useful example would be to tag specific components as debug, to distinguishing them as a visual aid for debugging purposes and separating them from regular objects in your scene with (for example) the SceneTag:

auto scene_tag = mResourceManager->findObject("SceneTag");
mRenderService->renderObjects(renderTarget, camera, render_comps, scene_tag);

The above code excludes components tagged as debug because we only include objects with the SceneTag. Tags can be combined (ORd etc.) to include objects from both sets, for example:

auto debug_tag = mResourceManager->findObject("DebugTag");
auto scene_tag = mResourceManager->findObject("SceneTag");
mRenderService->renderObjects(renderTarget, camera, render_comps, scene_tag | debug_tag);

The above call renders all components with a Debug or Scene tag.

Other Render Features

  • 4 new demos: lightsandshadow, skybox, spotlight and linemorphing
  • The nap::RenderAdvancedService auto updates light uniforms for meshes that are rendered with a compatible material
  • Shadow mapping handled by nap::RenderAdvancedService
  • Many new shaders, available in naprenderadvanced/data/shaders and naprender/data/shaders
  • nap::RenderSkyBoxComponent and nap::SkyBoxShader
  • nap::RenderFrustumComponent
  • Shader #include system with lots of utils naprenderadvanced/data/shaders
  • nap::DepthRenderTexture2D & nap::DepthRenderTarget - separate depth texture / target
  • nap::CubeDepthRenderTexture & nap::CubeRenderTexture
  • nap::SamplerCube- support for cube samplers
  • Depth sorting is updated to give higher priority to layers
  • Shadow mapping handled by nap::RenderAdvancedService
  • All nap::GPUBuffers are now transfer sources and destinations by default (TRANSFER_DST / TRANSFER_SRC)
  • Aesthetic / performance improvements to computeflocking demo

Napkin

Shader Inspection & Mapping

Allows the user to create material bindings based on shader declarations. All existing shader input types are supported, including: uniform, sampler, buffer and vertex bindings. Uniform resolving works for every type of nap::BaseMaterial and nap::MaterialInstanceResource, in combination with any type of shader. If no shader is linked or the shader can't be compiled the editor reverts to it's default (uniform creation) behaviour.

shader_inspection.mp4

Because of this change Napkin now depends on the naprender module. The engine is initialized when the project is loaded using nap::RenderService::initShaderCompilation. The added benefit of this change is that we can start using the render engine for more advanced render operations, in the editor, in the future. I introduced a couple of standardized property names to make sure the editor and engine are always in sync.

Toolbar & Shortcuts

The new toolbar displays items for the most common user actions, such as loading a project, opening a file, saving a file, creating a new resource, and accessing the documentation page. Additionally, new keyboard shortcuts have been added for many actions, including opening a project (ctrl+k) and creating a resource (ctrl+r). Pressing d in the resource or scene panel now attempts to delete the selected item.

Special disabled icons have been introduced to better inform users about available options. Actions are now unified between the menu and toolbar using a new (basic) napkin::ActionModel, which creates and groups common actions. Many actions, including all file and configuration actions, remain disabled until a project is loaded.

Reorder Items

You can rearrange items in a list by choosing move .. up or move .. down from the context menu in the resource and inspector panel. The introduction of the new MenuOption and MenuOptionController simplifies the process of registering, creating, and managing context menu options, providing a more straightforward approach compared to the complex if/else structure previously employed.

Screenshot 2024-01-04 140502

Clear Links

Entity, component and resource pointers can now be cleared, resetting them to NULL. Attempting to clear a required link triggers a warning. Required but invalid links (pointers) are colored red, optional links yellow:

Screenshot 2024-01-04 135833

Resource & Property Tooltips

Added documentation to all serializable and configurable NAP Objects, including: Resources, Entities, Components and Services. The documentation is displayed as a tool-tip (help) in Napkin before creating a new resource (for inspection) and when hovering over an item in the resource, inspector and service panel:

333270933-de32081a-e1ef-4bf6-9bf9-e376697ec1c1

Documentation is completely optional, but when given directly compiled into the object using RTTI:

RTTI_BEGIN_CLASS_NO_DEFAULT_CONSTRUCTOR(nap::ImageFromFile, "2D image that is loaded from disk and uploaded to the GPU. Holds the CPU (bitmap) and GPU (texture) data")
	RTTI_CONSTRUCTOR(nap::Core&)
	RTTI_PROPERTY("ImagePath", &nap::ImageFromFile::mImagePath, nap::rtti::EPropertyMetaData::Required, "Path to the image on disk")
	RTTI_PROPERTY("GenerateLods", &nap::ImageFromFile::mGenerateLods, nap::rtti::EPropertyMetaData::Default, "If lower levels of detail (LODs) are auto-generated for the image")
RTTI_END_CLASS

Napkin automatically detects and displays it as a tooltip when hovering over a resource, service or property.

Object Duplication

Added option to duplicate (deep copy) an object - including regular resources, components and entities - in the resource panel. The duplicated object can have an optional parent (entity / group), the duplicated object will be inserted after the source object index.

Screenshot 2024-05-29 175435

Instance Property Handling

Support for component pointer instance overrides has been incorporated into Napkin through RTTI. Additionally, enhancements have been made to the display, setting and handling of instance properties overall, resulting in a better user experience.

afbeelding

Other Napkin Features

  • Improved Entity & Component link (pointer) patching
  • General optimizations (caching, path handling, object handling etc.)
  • Various visual tweaks (more uniform)
  • Documentation and formatting have been refined, in accordance with the style guide.

OpenSSL & Secure Websockets

Support for the secure WebSocket protocol wss:// has been introduced alongside the insecure ws:// for both server and client endpoints, in the form of a nap::SecureWebSocketServerEndPoint and SecureWebSocketClientEndPoint. Try and run the websocketserver or webportal demo with a SecureWebSocketServerEndPoint (instead of the regular one) and check if you can get encrypted communication going!

Encryption

  • Axed CryptoPP in favor of openssl
  • Created napopenssl which embeds openssl 3.2.0 and exposes some utility methods (see files in system_modules/napopenssl/src)
  • Modified tool keygen to work with napopenssl
  • Modified tool licensegenerator to work with napopenssl
  • Modified napwebsocket to support TLS encrypted websocket communication
  • WebSocketServerEndPoint<wspp::Config> and WebSocketServerEndPoint<wspp::ConfigTLS> are supported now
  • WebSocketServerEndPoint<wspp::ConfigTLS> exposes extra certificate related properties
  • WebSocketCliendEndPoint<wspp::Config> and WebSocketCliendEndPoint<wspp::ConfigTLS> are supported now
  • WebSocketCliendEndPoint<wspp::ConfigTLS> exposes extra certificate related properties
  • Modified naplicense to work with napopenssl

Audio Changes

  • All portaudio device functionality is moved to a new napportaudio module that depends on napaudio.
  • Audio file support in napaudio is made optional using a compiler setting NAP_AUDIOFILE_SUPPORT in module_extra.cmake
  • Midi hardware port support using RtMidi is made optional using a compiler setting NAP_ENABLE_RTMIDI

Fixes & Improvements

  • Export LogHandler so it is possible to extend and create your own loghandlers (core)
  • Fix build environment check from source (build)
  • Support Linux arm64 kernel on 32bit libs (build)
  • Fixed issue where deltaTime could become nan when using SequencePlayerAudioClock (napsequenceaudio)
  • Fix napkin crash creating context menu with invalid (null) element (napkin)
  • Re-Introduce lineblending demo as linemorph demo, demonstrates the use of nap::PolyLine and dynamic meshes (demo)
  • Compute groupsize fix, inform user to create shader constants for custom group size specification (naprender)
  • Report ID's of objects that cause initialization to fail (core)

Obsolete

We have discontinued support for macOS as a target operating system. Our development efforts are now directed towards ensuring compatibility with other open platforms. If attempting to generate a solution in macOS, CMake will produce this error message and halt execution. Following this decision, we have not validated this release with macOS. While some parts may function correctly, others may not. Unfortunately this also means that we will no longer address any issues or requests specifically related to macOS.

Breaking Changes

This release has almost no breaking changes, apart from:

Audio

  • Apps with audio device input/output should depend on napportaudio module instead of the napaudio module.
  • All audio device functionality is moved from the AudioService to the PortAudioService, therefore:
    • Apps that reference the AudioService should use the PortAudioService instead.
  • midiinputport.h and midioutputport.h have been moved to the midiport subdirectory, changing the includes to:
    • #include <midiport/midiinputport.h>
    • #include <midiport/midioutputport.h>

CMake

In order to be able to add optional functionality to a module, the file(GLOB_RECURSE) in cmake/nap_module.cmake is changed to a file(GLOB). Subdirectories now have to be added manually to your module_extra.cmake, using the add_source_dir() macro from macros_and_functions.cmake.

Licenses

Licenses generated through the licensegenerator and keygen tools from a prior iteration of NAP are incompatible with NAP 0.7.X applications. This disparity arises from the shift in the underlying cryptography library, where the naplicense module and associated licensegenerator / keygen tools now rely on OpenSSL instead of CryptoPP. Consequently, licenses generated using the older tools cannot be used with this updated version of NAP and vice versa.

I'd like to thank @TimGroeneboom, @lshoek, @stijnvanbeek, @cklosters and @cheywood for their contributions and commitment!