Jump to content

Ultra Engine testing


Josh
 Share

Recommended Posts

While Start and Update are verbs, they also have a different meaning than Collide. 

Maybe some guideline would help: 

If something is definitely called every time (like Start or Update) use the verb.

If something is called on a specific condition it should (in my opinion) called something like: On... e.g: OnCollision

 

The problem with the collide(...) in this context is that it could be misintrepted as it actually is the reaction of a Collision and does not actually does the Collision.

 

 

  • Like 1
  • Upvote 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

There currently is not one. I found that the player collision was far better when I load a map and maintain brushes as separate objects, each using a convex hull collider. Like, a lot better, it avoids some ugly glitches. But that doesn't keep track of separate faces, so there's no separate materials. There is probably a way to figure out the closest face to the hit point.

I also plan to migrate over to Newton 4 gradually, but we don't know yet how or if the situation will be any different

Since it is undetermined I am leaving it out for now.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

a small experiment with the refraction shader and some modifications to get animated textures to work:

image.thumb.png.bf5bcb4d2b3d13050596ccf0497d026c.png

you can see, that the water is blending nicely with the terrain. The normal map is the animated 3d texture Josh created in his blog. Unfortunatly the normal isn't stored currently in the refraction inputs, but this should be no problem later. The blending is calculated by actual thickness of the volume and could be (in theory) modified by some kind of visibility parameter or, maybe the alpha value or something like this.

  • Like 4
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

That's looks good.  Is this an infinite water plane or will it work with any custom shape?

 

@Josh A lots changed since I've last compiled a custom shader - is this still possible?  I get a few errors currently, I see Base.frag is now base_frag.glsl but I'm not sure if I should be suing that anymore...

Link to comment
Share on other sites

3 minutes ago, SpiderPig said:

That's looks good.  Is this an infinite water plane or will it work with any custom shape?

@Josh A lots changed since I've last compiled a custom shader - is this still possible?  I get a few errors currently, I see Base.frag is now base_frag.glsl but I'm not sure if I should be suing that anymore...

My plan for this is to use a visual node editor that autogenerates a shader family from a template.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

1 minute ago, SpiderPig said:

That's looks good.  Is this an infinite water plane or will it work with any custom shape?

@Josh A lots changed since I've last compiled a custom shader - is this still possible?  I get a few errors currently, I see Base.frag is now base_frag.glsl but I'm not sure if I should be suing that anymore...

This is currently just a plane generated with CreatePlane and some customizations made to the PBR and rafraction shaders to restore some functionality Josh has currently disabled (animated textures, texture scaling). It is more or less a test how easy it is to get properly refracted materials in the engine. In Leadwerks you have to create your own renderer for custom water (if not deffered) you need to get a rrefraction and reflection texture. But in UltraEngine this works out of the box (nearly). 

  • Like 1
  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

Hi Josh. As shown above i use your generated water1.dds. And as you can see the dds works, but is generated wrong (only miplevel 0 is animating). As it is a volume texture the z component is of constant size and must not be divided for the mipmapchain as the chain should always have 128 slices for each miplevel.

int framecount = 128;
	std::vector<shared_ptr<Pixmap> > pixmaps(framecount);
	for (int n = 0; n < framecount; ++n)
	{
		pixmaps[n] = LoadPixmap("Materials/Animations/water1_" + String(n) + ".png");
	}

	//Build mipmaps
	iVec3 size = iVec3(pixmaps[0]->size.x, pixmaps[0]->size.y, pixmaps.size());
	auto mipchain = pixmaps;
	while (true)
	{
		auto osize = size;
		size.x = Max(1, size.x / 2);
		size.y = Max(1, size.y / 2);
		size.z = Max(1, size.z);
		for (int n = 0; n < size.z - 1; ++n)
		{
			Print(n);
			auto a = pixmaps[n + 0];
			auto b = pixmaps[n + 1];
			auto mipmap = CreatePixmap(osize.x, osize.y, pixmaps[0]->format);
			for (int x = 0; x < osize.x; x++)
			{
				for (int y = 0; y < osize.y; y++)
				{
					int rgba0 = a->ReadPixel(x, y);
					int rgba1 = b->ReadPixel(x, y);
					int rgba = RGBA((Red(rgba0) + Red(rgba1)) / 2, (Green(rgba0) + Green(rgba1)) / 2, (Blue(rgba0) + Blue(rgba1)) / 2, (Alpha(rgba0) + Alpha(rgba1)) / 2);
					mipmap->WritePixel(x, y, rgba);
				}
			}
			mipmap = mipmap->Resize(size.x, size.y);
			pixmaps[n] = mipmap;
			mipchain.push_back(mipmap);
		}
		if (size.x == 1 && size.y == 1) break;
	}

	SaveTexture("water2.dds", TEXTURE_3D, mipchain, framecount);

This should work correctly, but the SaveTexture is now complaing about wrong miplevel count. 

Saving texture "water2.dds"
Error: Incorrect numbers of images in mipchain

I assume this is because the z component is wrong calculated in the SaveTexture - Validation.

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

1 hour ago, SpiderPig said:

Not sure if this a bug, if I set a material to a model and then add a mesh to that model, the material is not assigned to the new mesh.  You have to re-apply the material.  Should it be so?  I don't know... <_<

This behavior is correct.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Update

  • Stream::EoF() is now Stream::Eof()
  • Window::HideMouse / ShowMouse removed, use Window::SetCursor with CURSOR_NULL instead
  • TextureBuffer example now working. Do not run this until you update the SDK, the previous build will crash your graphics driver
  • Lots of small API adjustments and work on the documentation
  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Update

  • Like 3

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

On 12/3/2022 at 4:09 PM, klepto2 said:

This should work correctly, but the SaveTexture is now complaing about wrong miplevel count. 


Saving texture "water2.dds"
Error: Incorrect numbers of images in mipchain

I assume this is because the z component is wrong calculated in the SaveTexture - Validation.

Wait...wouldn't the Z axis be half as big each mipmap?

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto plg = LoadPlugin("Plugins/FITextureLoader");

    int framecount = 128;
    std::vector<shared_ptr<Pixmap> > pixmaps(framecount);
    for (int n = 0; n < framecount; ++n)
    {
        pixmaps[n] = LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Animations/water1_" + String(n) + ".png");
    }

    //Build mipmaps
    iVec3 size = iVec3(pixmaps[0]->size.x, pixmaps[0]->size.y, pixmaps.size());
    auto mipchain = pixmaps;
    while (true)
    {
        auto osize = size;
        size.x = Max(1, size.x / 2);
        size.y = Max(1, size.y / 2);
        size.z = Max(1, size.z / 2);
        for (int n = 0; n < size.z; ++n)
        {
            auto a = pixmaps[n * 2 + 0];
            auto b = pixmaps[n * 2 + 1];
            auto mipmap = CreatePixmap(osize.x, osize.x, pixmaps[0]->format);
            for (int x = 0; x < pixmaps[0]->size.x; ++x)
            {
                for (int y = 0; y < pixmaps[0]->size.y; ++y)
                {
                    int rgba0 = a->ReadPixel(x, y);
                    int rgba1 = b->ReadPixel(x, y);
                    int rgba = Rgba((Red(rgba0) + Red(rgba1)) / 2, (Green(rgba0) + Green(rgba1)) / 2, (Blue(rgba0) + Blue(rgba1)) / 2, (Alpha(rgba0) + Alpha(rgba1)) / 2);
                    mipmap->WritePixel(x, y, rgba);
                }
            }
            mipmap = mipmap->Resize(size.x, size.y);
            pixmaps[n] = mipmap;
            mipchain.push_back(mipmap);
        }
        if (size == iVec3(1, 1, 1)) break;
    }

    //Convert to compressed format
    for (int n = 0; n < mipchain.size(); ++n)
    {
        mipchain[n] = mipchain[n]->Convert(TEXTURE_BC5);
    }

    //Save
    SaveTexture(GetPath(PATH_DESKTOP) + "/water1.dds", TEXTURE_3D, mipchain, framecount);

    return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

32 minutes ago, Josh said:

All acronym capitalization changed to camelcase: Camera::SetFOV is now SetFov. AABB is now Aabb. RGBA() is Rgba()

The "readable aesthetic" and "grammar nazi" sides of my brain are fighting over the value of this particular change 😅

Thanks for the hard work you've put into this so far.

  • Like 1

i now hate love C++

Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep

RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect

Link to comment
Share on other sites

It's crashing on one of the instructions the rendering command buffer executes, so it could be anything. Please send me code to produce the problem.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I just updated my project, and it just copied the $PROJECTNAME.vcxproj file without renaming and overriding the old project. I had to redo my fix for my preprocessor and I ended up just deleting everything regarding the components for it to compile again.  

I know project files will probably not change much after the release, but I also had to redefine my external libraries. I would suggest a dedicated directory for external libraries, that all projects have included but that could cause some issues. 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

9 hours ago, Josh said:

Wait...wouldn't the Z axis be half as big each mipmap?


#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto plg = LoadPlugin("Plugins/FITextureLoader");

    int framecount = 128;
    std::vector<shared_ptr<Pixmap> > pixmaps(framecount);
    for (int n = 0; n < framecount; ++n)
    {
        pixmaps[n] = LoadPixmap("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Materials/Animations/water1_" + String(n) + ".png");
    }

    //Build mipmaps
    iVec3 size = iVec3(pixmaps[0]->size.x, pixmaps[0]->size.y, pixmaps.size());
    auto mipchain = pixmaps;
    while (true)
    {
        auto osize = size;
        size.x = Max(1, size.x / 2);
        size.y = Max(1, size.y / 2);
        size.z = Max(1, size.z / 2);
        for (int n = 0; n < size.z; ++n)
        {
            auto a = pixmaps[n * 2 + 0];
            auto b = pixmaps[n * 2 + 1];
            auto mipmap = CreatePixmap(osize.x, osize.x, pixmaps[0]->format);
            for (int x = 0; x < pixmaps[0]->size.x; ++x)
            {
                for (int y = 0; y < pixmaps[0]->size.y; ++y)
                {
                    int rgba0 = a->ReadPixel(x, y);
                    int rgba1 = b->ReadPixel(x, y);
                    int rgba = Rgba((Red(rgba0) + Red(rgba1)) / 2, (Green(rgba0) + Green(rgba1)) / 2, (Blue(rgba0) + Blue(rgba1)) / 2, (Alpha(rgba0) + Alpha(rgba1)) / 2);
                    mipmap->WritePixel(x, y, rgba);
                }
            }
            mipmap = mipmap->Resize(size.x, size.y);
            pixmaps[n] = mipmap;
            mipchain.push_back(mipmap);
        }
        if (size == iVec3(1, 1, 1)) break;
    }

    //Convert to compressed format
    for (int n = 0; n < mipchain.size(); ++n)
    {
        mipchain[n] = mipchain[n]->Convert(TEXTURE_BC5);
    }

    //Save
    SaveTexture(GetPath(PATH_DESKTOP) + "/water1.dds", TEXTURE_3D, mipchain, framecount);

    return 0;
}

Of course, you are right. Then there must be another error in it. Because everything is not animated with miplevel > 0. I take another look at it.

  • Intel® Core™ i7-8550U @ 1.80 Ghz 
  • 16GB RAM 
  • INTEL UHD Graphics 620
  • Windows 10 Pro 64-Bit-Version
Link to comment
Share on other sites

  • Josh changed the title to Ultra Engine testing
  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...