Create a 3d surface plot chart?

Hi everyone, i´m working in a mini visualization software and i’m looking for help. I’m stuck trying to do a “3d graphic chart”, i have a 3x3 grid with points (x,y) i need to plot the height (z) values of each point, in a surface like the picture below, i dont know where to start. could anyone give me some advise, sorry about my English, and thankyou!


55346-sd.jpg

This will just be a brief high-level description of what to do. Obviously, nobody can write all of this code for you or tell you exactly what to do, because it would take days/weeks. I’m assuming the 3x3 data points will be generated or discovered at runtime, not offline before packaging, so it must be dynamic.

To create the 3D surface:

  1. Fill a 3x3 1-channel 2D float16 or float32 texture with your height point data.
  2. Upsample the texture to whatever resolution you will need rendered using whatever resampling algorithm produces the type of smoothing for the 3d surface you want. 256x256 would be a good starting target to aim for. Note that it will never look the same as the first picture you posted, because those curves are generated from continuous mathematical functions and not simple discrete data points.
  3. Create a flat grid mesh asset, with whatever resolution is appropriate. 256x256 vertices would be fine. You can generate this in a 3DCC program such as Blender or Maya and import it to UE4. This will be done offline and packaged into your game – it’s the same regardless of your 3x3 point data.
  4. Create a material which takes a 2D texture parameter and projects the X,Y of the bounds of the mesh grid to within the U,V space of the texture. Sample the texture and use the value (multiplied by some scalar for how high you want it to be) to go to the World Position Offset output channel on the material.

To draw the lines:

  1. Declare a custom Slate widget inheriting from SLeafWidget. You will want to override this method in particular:

    virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const;

  2. Get the projection matrix from your game world viewport and into your Slate widget on each tick. A good place to do this would be within your custom HUD subclass within DrawHUD. You will use the projection matrix for doing 2D drawing within OnPaint to draw your vector lines and points.

  3. Within OnPaint, draw the lines and points necessary (for example, using FSlateDrawElement::MakeLines(…)) using your projection matrix onto the Slate canvas. Customize the styling as you like.

If you are new to UE4 and Slate, this will probably take you several weeks. Good luck!

Thankyou cancel, yes i’m asuming that this will take several weeks, i will try to follow the instructions you suggest. I just want to know if a coarse solution of this, could be done enterely in unreal via blueprint or material nodes. i will post my progress to the comunity. thanks Again!

No problem. Yes, advanced things like this require C++. Good luck on your adventure!

(By the way, you have to mark the answer as accepted again after leaving a new comment. Thanks!)