Out of video memory

Hi,

I post here my comment for this question, as there is a char count limit on the answer hub :
https://answers.unrealengine.com/questions/329585/out-of-video-memory.html

So, here are 2 screenshots of the starfield. First one is taken immediatly after starting PIE, second on 25 sec later. Not how billboards stars are more bright on the second one :


The code :


bool UAUGalaxy::CreateStarField(int sectorIndex, UWorld * world)
{
	if (sectorIndex < 0 || sectorIndex > Sectors.Num() - 1)
		return false;

	UE_LOG(LogTemp, Warning, TEXT("sectorIndex IN RANGE"));

	FGalaxySector sector = Sectors[sectorIndex];
	int systemCount = sector.SolarSystems.Num();

	if (systemCount > 0)
	{
		if (world)
		{
			UE_LOG(LogTemp, Warning, TEXT("WORLD FOUND !!!!!"));

			UAUGameInstance * gameInstance = (UAUGameInstance*)world->GetGameInstance();
			if (gameInstance)
			{
				FActorSpawnParameters spawnParams;
				spawnParams.Name = "StarField";
				spawnParams.bNoFail = true;

				AActor * StarField = world->SpawnActor(gameInstance->StarField, new FVector(FVector::ZeroVector), new FRotator(FRotator::ZeroRotator), spawnParams);
				USceneComponent * defaultSceneRoot = StarField->GetRootComponent();
				defaultSceneRoot->RegisterComponent();
				FGalaxySector sector = Sectors[sectorIndex];

				UE_LOG(LogTemp, Warning, TEXT("UAUGameInstance FOUND !!!!!"));
				UMaterialInterface * materialInterface = gameInstance->starBillboardMaterialInstance;

				for (int i = 0; i < systemCount; i++)
				{
					UE_LOG(LogTemp, Warning, TEXT("Attach impostor %d"), i);
					FSolarSystem system = sector.SolarSystems*;

					FActorSpawnParameters starSpawnParams;
					FString string = FString::FromInt(sectorIndex);
					string.Append(FString("_StarImpostor_"));
					string.AppendInt(i);

					FName baseName;
					baseName.AppendString(string);

					starSpawnParams.Name = baseName;
					starSpawnParams.bNoFail = true;
					**AActor * star = world->SpawnActor(gameInstance->StarImpostor, &system.Position, new FRotator(FRotator::ZeroRotator), starSpawnParams);**
					star->AttachRootComponentTo(defaultSceneRoot, NAME_None, EAttachLocation::KeepRelativeOffset);
				}

				//defaultSceneRoot->MarkRenderStateDirty();
			}
			else
			{
				UE_LOG(LogTemp, Warning, TEXT("No UAUGameInstance"));
				return false;
			}
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("No UWorld"));
			return false;
		}

		return true;
	}

	return false;
}

Called from :



APlayerController* AAbyssUniverseGameMode::SpawnPlayerController(ENetRole InRemoteRole, FVector const& SpawnLocation, FRotator const& SpawnRotation)
{
	APlayerController * NewPlayer = Super::SpawnPlayerController(InRemoteRole, SpawnLocation, SpawnRotation);
	AAUPlayerController * pc = Cast<AAUPlayerController>(NewPlayer);
	
	if (pc)
	{
		UE_LOG(LogTemp, Warning, TEXT("AAUPlayerController OK"));
		UAUGameInstance * gameInstance = Cast<UAUGameInstance>(GetGameInstance());
		UWorld * world = GetWorld();

		if (gameInstance)
		{
			UE_LOG(LogTemp, Warning, TEXT("UAUGameInstance OK"));
			UAUGalaxy * galaxy = gameInstance->Galaxy;

			if (galaxy)
			{
				UE_LOG(LogTemp, Warning, TEXT("UAUGalaxy OK"));
				**galaxy->CreateStarField(gameInstance->StartSector, world);**

			}
			else
			{
				UE_LOG(LogTemp, Warning, TEXT("NO UAUGalaxy"));
			}
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("WRONG GameInstance"));
		}
	}
	else
	{
		UE_LOG(LogTemp, Warning, TEXT("WRONG PlayerController"));
	}
	return pc;
}

And the bug report :

I cant see how many actors you have in the screen shots, but an issue I had before was similar. The only advice I can give you is to make sure you aren’t making the same things over and over, each frame. That might also explain why they are brighter, as there are more dots at each location.