Hooo, great ! Looking forward to those improvements !
Question, how to use Tessellation with this? Iām having trouble figuring it out.
I believe I need to check the Bool property for āGenerate Tessellation Trianglesā and then use this āSet Section Tessellation Trianglesā. How to setup that properly? What are those tessellation triangles exactly?
Please help, right now time is of the essence.
You should only need to set the bool on Create/Updateā¦ SetSectionTessellationTriangles is only if you use the utility to calculate it separately, like if you wanted to do it on another thread.
Does this plugin work with 4.14? I am thinking of procedurally creating a couple of (building) RMCs and then converting them to normal static meshes for further use.
The overall plugin supports back to 4.10, the current version supports 4.13 and 4.14. The marketplace is the easiest place to get it. Otherwise you can install it from github in which case it should work with 4.15 and master branch source as well.
On another note, the slicer is known to be extremely buggy right now. Iām looking into it slowly.
Okay, that worked. Now, I want to use it with C++, but I just canāt seem to get it working. Please have in mind that Iām starting with C++. So:
Added lines in Build.cs:
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class FlyingShip : ModuleRules
{
public FlyingShip(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore"});
PrivateDependencyModuleNames.AddRange(new string] { });
PublicDependencyModuleNames.AddRange(new string] { "ShaderCore", "RenderCore", "RHI", "RuntimeMeshComponent"});
}
}
*.h file:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "SeaSurface.generated.h"
UCLASS()
class FLYINGSHIP_API ASeaSurface : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASeaSurface();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
private:
UPROPERTY(VisibleAnywhere, Category = Materials)
RuntimeMeshComponent * SeaMesh;
};
*.cpp file:
// Fill out your copyright notice in the Description page of Project Settings.
#include "FlyingShip.h"
#include "SeaSurface.h"
#include "RuntimeMeshComponent.h"
// Sets default values
ASeaSurface::ASeaSurface()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SeaMesh = CreateDefaultSubobject<RuntimeMeshComponent>(TEXT("GeneratedMesh"));
RootComponent = SeaMesh;
}
// Called when the game starts or when spawned
void ASeaSurface::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASeaSurface::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
Error:
1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Build started: Project: FlyingShip, Configuration: Development_Editor x64 ------
2> Creating makefile for FlyingShipEditor (no existing makefile)
2> Parsing headers for FlyingShipEditor
2> Running UnrealHeaderTool "O:\FlyingShip\FlyingShip.uproject" "O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>O:/FlyingShip/Source/FlyingShip/FishingShip/SeaSurface.h(25): error : Unrecognized type 'RuntimeMeshComponent' - type must be a UCLASS, USTRUCT or UENUM
2>EXEC : error : UnrealHeaderTool failed for target 'FlyingShipEditor' (platform: Win64, module info: O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest, exit code: OtherCompilationError (5)).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""E:\Unreal Engine 4\Epic Games\4.14\Engine\Build\BatchFiles\Build.bat" FlyingShipEditor Win64 Development "O:\FlyingShip\FlyingShip.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What am I doing wrong?
Add
#include "RuntimeMeshComponent.h"
to the header file as well.
if:
#include "GameFramework/Actor.h"
#include "RuntimeMeshComponent.h"
#include "SeaSurface.generated.h"
then:
2> Parsing headers for FlyingShipEditor
2> Running UnrealHeaderTool "O:\FlyingShip\FlyingShip.uproject" "O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>O:/FlyingShip/Source/FlyingShip/FishingShip/SeaSurface.h(70): error : Unrecognized type 'RuntimeMeshComponent' - type must be a UCLASS, USTRUCT or UENUM
2>EXEC : error : UnrealHeaderTool failed for target 'FlyingShipEditor' (platform: Win64, module info: O:\FlyingShip\Intermediate\Build\Win64\FlyingShipEditor\Development\FlyingShipEditor.uhtmanifest, exit code: OtherCompilationError (5)).
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""E:\Unreal Engine 4\Epic Games\4.14\Engine\Build\BatchFiles\Build.bat" FlyingShipEditor Win64 Development "O:\FlyingShip\FlyingShip.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Iām hopelessā¦
Hey , thanks for the information. I ended up using Hierarchical Instanced Static Mesh to create instances with collision. This appears to work extremely fast. Iāve split my terrain into two parts, one is a gigantic single mesh with no collision, and the other the same mesh broken into regions (components). These components do have collision(static) but Iāve turned the visibility off after they are built. This appears to retain the collision while hiding the actual mesh. Now that Iām updating parts by removing them from the terrain RMC system and making an instance in the HISMC I need to update the collision of the RMC that is collision slices with visibility turned off. I thought it would automatically update the collision because Iāve updated the vertex locations of that RMC slice. Does it matter that the RMC visibility is turned off? I still want the collision to work, but have the visibilty to be turned off. Any ideas?
Nevermind, I was using EndMeshSectionPositionUpdate instead I should have used EndMeshSectionUpdate. This allows the collision RMCs to update their vertex positions while their visual mesh remains hidden.
I am kinda clueless about your error, but did you try using āclass RuntimeMeshComponentā in your header files instead of āRuntimeMeshComponentā?
GOT IT!
First, I need a header in the .h file. Okay.
Then:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mesh)
class URuntimeMeshComponent *SeaMesh;
And it works.
Thank you very much for your help!
Hey guys, I wanted to test the performance of this plugin by creating a very high poly sphere (say, 1 million triangles).
Does anyone have the code to generate a parametric sphere like that? Iām messing around with algorithms, but things are getting complicated for me and I donāt want to lose too much time for this, so if anyone has something already done it would be a big help
Making a sphere isnāt that hard
If you already understand how to create verts and indices enough to make basic boxes, youāre most of the way there.
So for instance in eden, I start with a box (with each side being made up of a grid of polygons) then iterate through all of the vert positions mooshing them into a sphere using getSafeNormal which shrinks them to the surface of a unit sphere, then multiply their position again to scale the sphere upto whatever size I want.
Hi , loving your plugin!
Got a couple of qnsā¦
qns 1: how to uninstall the marketplace plugin? There doesnt seem to have an option in the launcher to uninstall it.
qns 2: is it possible to selectively select either marketplace plugin or github plugin in UE4editor>>edit>>plugins? I have made a mess by installing both marketplace plugin and github plugin. And would need just one of them.
In case anyone needs it, I managed to create the sphere, hereās the code (Iām actually using the ProceduralMeshComponent in this one, but the code stays basically the same):
void ASphereActor::GenerateSphereMesh()
{
mVertices.Empty();
mIndices.Empty();
mNormals.Empty();
mUvs.Empty();
mVertexColors.Empty();
mTangents.Empty();
CreateSphereWithTriangles(mVertices, mIndices, mNormals, SphereRadius, SphereRings, SphereSectors);
mMesh->CreateMeshSection(0, mVertices, mIndices, mNormals, mUvs, mVertexColors, mTangents, false);
}
void ASphereActor::CreateSphereWithTriangles(TArray<FVector> &vertices, TArray<int32> &indices, TArray<FVector> &normals, float radius, int stacks, int slices)
{
double stackAngle = PI / stacks;
double sliceAngle = 2.0 * PI / slices;
int i, j, v1_index, v2_index, v3_index;
double a = 0;
double b = a + stackAngle;
double r0 = radius * sin(a);
double r1 = radius * sin(b);
float z0 = radius * cos(a);
float z1 = radius * cos(b);
double c = 0;
float x = cos(c);
float y = sin(c);
vertices.Add(FVector(x * r0, y * r0, z0));
v1_index = vertices.Num();
vertices.Add(FVector(x * r1, y * r1, z1));
v2_index = vertices.Num();
for (i = 0; i < stacks; i++)
{
a = i * stackAngle;
b = a + stackAngle;
r0 = radius * sin(a);
r1 = radius * sin(b);
z0 = radius * cos(a);
z1 = radius * cos(b);
j = i ? 0 : 1;
for (; j <= slices; j++)
{
c = j * sliceAngle;
x = cos(c);
y = sin(c);
vertices.Add(FVector(x * r0, y * r0, z0));
v3_index = vertices.Num();
indices.Add(v1_index);
indices.Add(v2_index);
indices.Add(v3_index);
v1_index = v3_index;
vertices.Add(FVector(x * r1, y * r1, z1));
v3_index = vertices.Num();
indices.Add(v1_index);
indices.Add(v2_index);
indices.Add(v3_index);
v2_index = v3_index;
}
}
}
Itās not the prettiest code but it works:
I am currently having some issues with line trace. It seems the collision bounds are different from the odd shape runtimemesh. Is there a way to pass the collision shape to the runtimemesh function?
Dev Grant Nomination for the RMC!
This is long shot but itās worth a try. I started a thread, and hope to get support from others like me using the RMC in the hope that we can convince Epic to give a dev grant for the work heās done on the RMC.
Iād like to thank for the work heās done so far!
If you use the RMC and think Epic should look into giving a dev grant, please support it here: Nominate the RuntimeMeshComponent for a dev grant! - Feedback & Requests - Epic Developer Community Forums
Just stopping by to say I started to use it and it is great! Thank you very much for such a great free addition @!
Bug report: Trying to #require Components/SplineComponent.h in a project that has this plugin (doesnāt have to be the same class that uses RMC) results in a spate of errors from VS:
G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2065: āUMaterialInterfaceā: undeclared identifier
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2059: syntax error: ā,ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2976: āTMapā: too few template arguments
2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of āTMapā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2065: āUMaterialInterfaceā: undeclared identifier
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2059: syntax error: ā,ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2976: āTMapā: too few template arguments
2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of āTMapā
2> MyRuntimeActorComponent.cpp
2>G:\Kasia\UE4 project\cpp\MyProject2 - Kopia\Source\MyProject2\MyRuntimeActorComponent.cpp(1): error C2059: syntax error: ā.ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(357): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(357): error C2143: syntax error: missing ā,ā before ā&ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(364): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(364): error C2143: syntax error: missing ā,ā before ā&ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(367): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/EngineBaseTypes.h(367): error C2143: syntax error: missing ā,ā before ā&ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2065: āUMaterialInterfaceā: undeclared identifier
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2059: syntax error: ā,ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(214): error C2976: āTMapā: too few template arguments
2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of āTMapā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2065: āUMaterialInterfaceā: undeclared identifier
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2059: syntax error: ā,ā
2>G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Engine\Classes\Engine/TextureStreamingTypes.h(217): error C2976: āTMapā: too few template arguments
2> G:\Kasia\UE4 Launcher\Epic Games\4.14\Engine\Source\Runtime\Core\Public\Containers\Map.h(927): note: see declaration of āTMapā
2>ERROR : UBT error : Failed to produce item: G:\Kasia\UE4 project\cpp\MyProject2 - Kopia\Binaries\Win64\UE4Editor-MyProject2.pdb
Curiously enough, I can work with splines and RMC in blueprints.